Skip to content

Instantly share code, notes, and snippets.

@alfwatt
Last active September 22, 2015 02:32
Show Gist options
  • Save alfwatt/cb76d78888008e27a44d to your computer and use it in GitHub Desktop.
Save alfwatt/cb76d78888008e27a44d to your computer and use it in GitHub Desktop.
+ (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