Hi! I just started using exception handling (never had chance before). What you guys think it is best:
Or:Code:try{ //code that throws Exception_1 //code that do not throws anything //code that throws Exception_2 } catch(Exception_1 e1){ //handle exceptions } catch(Exception_2 e2){ //handle exceptions }
Code:try{ //code that throws Exception_1 } catch(Exception_1){ //handle exceptions } //code that do not throws anything try{ //code that throws Exception_2 } catch(Exception_2){ //handle exceptions } //handle exceptions
I think that, for large pieces of code, the second alternative is better. Do you agree? Also, I have a question, when you use catch(...) m how can you access the exception itself?Is there any global or method, or I must specify the parameter?
Thanks, as always.



LinkBack URL
About LinkBacks


