Top "Exception-handling" questions

An exception is an unusual condition that requires deviation from the program's normal flow.

Mockito How to mock and assert a thrown exception?

I'm using mockito in a junit test. How do you make an exception happen and then assert that it has (…

java exception-handling junit mockito
Python try-else

What is the intended use of the optional else clause of the try statement?

python exception-handling
How to throw a C++ exception

I have a very poor understanding of exception handling(i.e., how to customize throw, try, catch statements for my …

c++ exception-handling
How using try catch for exception handling is best practice

while maintaining my colleague's code from even someone who claims to be a senior developer, I often see the following …

c# .net exception exception-handling try-catch
How can I handle the warning of file_get_contents() function in PHP?

I wrote a PHP code like this $site="http://www.google.com"; $content = file_get_content($site); echo $content; But …

php function exception-handling warnings
System.Security.SecurityException when writing to Event Log

I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6) to Server 2008 (IIS7). When I …

asp.net windows iis-7 exception-handling event-log
Why is it bad style to `rescue Exception => e` in Ruby?

Ryan Davis’s Ruby QuickRef says (without explanation): Don’t rescue Exception. EVER. or I will stab you. Why not? …

ruby exception-handling
How to write trycatch in R

I want to write trycatch code to deal with error in downloading from the web. url <- c( "http://…

r exception exception-handling try-catch r-faq
I want to exception handle 'list index out of range.'

I am using BeautifulSoup and parsing some HTMLs. I'm getting a certain data from each HTML (using for loop) and …

python list exception-handling
What is the difference between `throw new Error` and `throw someObject`?

I want to write a common error handler which will catch custom errors thrown on purpose at any instance of …

javascript object error-handling exception-handling throw