objective c - Transition between @try @catch -
i'm having hard time understanding transition @ try @ catch
i understand if statement @try block throws exception, @catch block gets executed. don't understand how nsexception object containing information exception gets passed argument. lot of stuff i'm reading online exceptions skip detail.
the example book
@try { [myarray objectatindex: 2]; } @catch (nsexception *exception){ nslog(@"caught %@%@", exception.name, exception.reason); }
so once exception detected exception object automatically created , sent @catch block?
try , catch used exception handling. whenever error occurs in try block, compiler jumps corresponding catch block , passes exception object it. access exception object know details of error.
Comments
Post a Comment