NSError from NSException

priore Feb 5th, 2014 505 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (NSError*)NSErrorFromException:(NSException*)exc
  2. {
  3.     NSMutableDictionary * info = [NSMutableDictionary dictionary];
  4.     [info forKey:@"MONExceptionName"];
  5.     [info setValue:exc.reason forKey:@"MONExceptionReason"];
  6.     [info setValue:exc.callStackReturnAddresses forKey:@"MONExceptionCallStackReturnAddresses"];
  7.     [info setValue:exc.callStackSymbols forKey:@"MONExceptionCallStackSymbols"];
  8.     [info setValue:exc.userInfo forKey:@"MONExceptionUserInfo"];
  10.     return [[NSError alloc] initWithDomain:@"MyAppName" code:-1969 userInfo:info];
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand