priore

NSError from NSException

Feb 5th, 2014
589
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 setValue:exc.name 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"];
  9.    
  10.     return [[NSError alloc] initWithDomain:@"MyAppName" code:-1969 userInfo:info];
  11. }
RAW Paste Data