Skip to content

Instantly share code, notes, and snippets.

@alfwatt
Last active Sep 22, 2015
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