Questions tagged [exception-handling]

Exception handling is the process of responding to the occurrence of anomalous or exceptional conditions requiring special processing – often changing the normal flow of program execution.

In general, an exception is handled (resolved) by saving the current state of execution in a predefined place and switching the execution to a specific subroutine known as an exception handler. If exceptions are continuable, the handler may later resume the execution at the original location using the saved information.

From here

138 questions
26
votes
10 answers

Error handling - Should a program fail on errors or silently ignore them

I'm writing a simple little program to transmit MIDI over a network. I know that the program will encounter transmission problems and / or other exception situations that I won't be able to predict. For the exception handling, I see two approaches. …
16
votes
5 answers

Exception handling in a program that needs to run 24/7

I have read that we should only catch exceptions that can be handled, which makes catching the base exception class (C# in this case) a bad idea (on top of other reasons). I am currently part of a project in which I so far have yet to see anything…
user1323245
  • 461
  • 2
  • 8
8
votes
8 answers

Is it a acceptable approach to put try catch wherever null pointer exception occurs?

There are instances where the references to objects, fields, variables etc can be null and there might be a possible occurrence of Null Pointer exception occurring at that point. Is is a permanent solution to put these code blocks which expect Null…
2
votes
1 answer

I have a unexceptional exception. That is thrown by a API used in my project. Is it standard to log errors like these or handle them without logging

The API has a Throttle on the number of requests you can make. So we queue our requests in a local database and make as many requests as possible until the "Throttle exception" is thrown. Upon catching we exit the program and a scheduled task starts…
0
votes
1 answer

Exception handling scope when dealing with nested exceptions

Assume you have one object that has two methods which both throw different exceptions. These methods must be used together. For instance: SqlCon{ static SqlCon connect(string user, string pass) throws UnableToConnect; string[] query(string…
horvste
  • 101