Showing posts with label exception-handling. Show all posts
Showing posts with label exception-handling. Show all posts

Tuesday, May 15, 2012

When should I throw an exception as opposed to return an error in PHP?


I'm working on an API wrapper class, which is the first I've made. For the most part it hasn't been too difficult. Getting to the point where I need to deal with the potential of errors being returned by the API, however confused as to how I should go about dealing with them.

Wednesday, April 25, 2012

Try-catch-finally and then again a try catch


I have often come across situations like :-




try{
...
stmts
...
}
catch(Exception ex) {
...
stmts
...
} finally {
connection.close // throws an exception
}

Tuesday, April 3, 2012

Try-catch exception handling practice for iPhone/Objective-C


Apologies if this question has already been answered somewhere else, but I could not find any decisive answer when searching on it:

Saturday, February 25, 2012

Filereader null declarations and appending best practice


I want to optimise my file reader function but am not sure if it is best practice to declare the nulls outside of the try loop. Also, is looping and appending chars to a Stringbuffer considered bad practice? I would like to use the exception handling here, but maybe it is better to use another structure? any advice most welcome, thanks.

Thursday, February 16, 2012

Alternative solutions for android.os.NetworkOnMainThreadException


Now I'm solving the




android.os.NetworkOnMainThreadException




I put the connect method into separated thread, but when the thread starts, the start() method doesn't invoke the Run() , - and also using the AsyncTask , the task doesn't invoke the doInBackground() method!

Wednesday, February 8, 2012

Sunday, January 29, 2012

Distinguish new vs existing exceptions


I am creating a PHP application and I want to display the number of times an error has occurred. The problem that I am trying to figure out is if an error has already been reported or if its new using the following values: