Skip to content

Instantly share code, notes, and snippets.

@alfwatt
Last active September 22, 2015 02:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
+ (NSString*) errorReport:(NSError*) error
+ (NSString*) errorReport:(NSError*) error
{
NSMutableString* report = [NSMutableString new];
[report appendString:[NSString stringWithFormat:@"%@: %li\n\n%@", error.domain, error.code, error.userInfo]];
if( error = [[error userInfo] objectForKey:NSUnderlyingErrorKey] ) // we have to go deeper
{
[report appendString:[NSString stringWithFormat:@"\n\n- Underlying Error -\n\n"]];
[report appendString:[self errorReport:error]];
}
return report;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment