Linked Questions
26 questions linked to/from Best practices for exception management in Java or C#
3 votes
5 answers
2k views
All About Exceptions: What to do and Where to log?
My question actually comes in two parts hence the ambiguous title. Part One As far as I'm aware, you should never swallow an exception. Not even logging it and forgetting about. In general cases, I ...
2 votes
6 answers
4k views
Why do we follow narrow to broad Exception catching mecahnism in java?
Take this piece of code: try { FileReader f=new FileReader("D:/sda.t"); }catch(FileNotFoundException e) { e.printStackTrace(); ...
0 votes
7 answers
1k views
Is catching exceptions just lazy error checking? [closed]
I'm sure I'm going to catch flack for this... but I'm coming from a language with no try/catch blocks and I'm learning about Java exception catching, and I'm having a hard time seeing how it's not ...
6 votes
2 answers
1k views
What types of code blocks should I enclose with try-catch statement? [closed]
I have read and discussed the following questions and articles deeply and many others now and in the past: When to use try/catch blocks? Main method code entirely inside try/catch: Is it bad ...
1 vote
4 answers
1k views
which tiers should i catch exception when using DAL BLL and web Presentation Layer
I write a three tiers web application. DAL BLL and web Presentation Layer,every tier has methods , so the question is where should I catch exception( using try catch),in web?BLL?or DAL? and why? thank ...
2 votes
6 answers
228 views
What is the proper way to check for and handle null return values?
I have some methods that return a value (or object) if all went as planned, otherwise return null (something went wrong). For example, DataTable dt = DoSomething(); If something blew up in ...
6 votes
2 answers
758 views
Handling Known Errors and Error Messages in a Method
What are some good ways to handle known errors that occur in a method? Let's take a user registration method as an example. When a user is signing up, a method SignUp( User user ) is called. There ...
1 vote
4 answers
344 views
Java Propagating Exceptions
When would you want to propagate an exception to another Class/Method versus catching the Exception in the same Class/Method?
3 votes
3 answers
196 views
Is it a good practice to catch all exceptions and re-throw them as a particular type of exception in terms of classification? [closed]
Is it a good practice to catch all exceptions and re-throw them as a specific type -basically to classify all the exceptions thrown from a particular part (or service) of an application? Something ...
6 votes
0 answers
157 views
Exception or RuntimeException? [duplicate]
Possible Duplicate: In Java, when should I create a checked exception, and when should it be a runtime exception? I heard a lot of things about Exception over RuntimeException but no clear ...
2 votes
4 answers
109 views
Handling exceptions in Java application
When I throw an exception from the package in which I handle the database, in the package in which I handle the UI, should I throw the same exception or create another? The UI package should know ...