The nature of Exceptions
there are three different situations that cause exceptions to be thrown:
1. Exceptions due to programming errors
2. Exceptions due to client code errors
3. Exceptions due to the resource failures
Types of Exceptions in java
1. Checked Exceptions
2. Unchecked Exceptions
Best Practices for Designing the API
1. When deciding on checked exceptions vs.unchecked excpetions,ask yourself
"what action can client code take when excpetion occurs?"
2. Preserve encapsulation
3. Try not to create new custom exception if they don't have useful information
for client code.
4. Document exceptions
Best practices for using exceptions
1. Always clean up after yourself
2. never use excpetions for flow control
3. Do not suppress or ignore exceptions
4. Do not catch top-level exceptions.
5. Log exceptiions just once
you can refer to the original article of best practices of exception handling at fellowing link
http://onjava.com/pub/a/onjava/2003/11/19/exceptions.html
分享到:
相关推荐
Chapter 9: Best Practices for Function-Based Views Chapter 10: Best Practices for Class-Based Views Chapter 11: Form Fundamentals Chapter 12: Common Patterns for Forms Chapter 13: Templates: Best ...
NHTSA_Cybersecurity Best Practices for Modern Vehicles
英文版 IBM公司出品 Microservices Best Practices for Java Microservices Best Practices for Java
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
This document is intended to help those with a basic knowledge of machine learning get the benefit of best practices in machine learning from around Google. It presents a style for machine learning,...
Defensive Security Handbook: Best Practices for Securing Infrastructure by Lee Brotherston English | 3 Apr. 2017 | ASIN: B06Y18XC5Y | 268 Pages | AZW3 | 3.88 MB Despite the increase of high-profile ...
Best Practices for Running VMware vSphere on iSCSI 英文官方文档
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark
AWS Best Practices for DDoS Resiliency,是基于AWS上安全服务shield和WAF ALB和cloudfont已经Route53构建适合不同应用部署架构的防拒绝服务攻击的文档,可以帮助用户设计适合的防护机制。
Building Software Teams: Ten Best Practices for Effective Software Development English | 31 Dec. 2016 | ISBN: 149195177X | 136 Pages | AZW3/MOBI/EPUB/PDF (conv) | 6.49 MB Why does poor software ...
Best Practices for Implementing CTS+
Derived from years of experience working with data access developers, ADO.NET Examples and Best Practices for C# Programmers includes a set of techniques proven to drastically reduce overhead, ...
This technical report reviews the best practices for implementing VMware® vSphere® with NetApp unified storage arrays. NetApp has been providing advanced storage features to VMware solutions since ...
Best Practices for Upgrades to Oracle Database 11g Release 2 CN
High Performance Spark: Best Practices for Scaling and Optimizing Apache Spark by Holden Karau English | 25 May 2017 | ASIN: B0725YT69J | 358 Pages | AZW3 | 3.09 MB Apache Spark is amazing when ...
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或...
Learning Spark Streaming Best Practices for Scaling and Optimizing Apache Spark(Early Release) 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权...
Perl Best Practices author Damian Conway explains that rules, conventions, standards, and practices not only help programmers communicate and coordinate with one another, they also provide a reliable ...
wo Scoops of Django: Best Practices For Django 1.8 is chock-full of even more material that will help you with your Django projects.