Skip to content

Commit

Permalink
show error result
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Nov 27, 2012
1 parent ada3051 commit 3d64ef3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion VisualJSON/VJJsonDocumentDelegate.m
Expand Up @@ -33,7 +33,9 @@ - (BOOL)document:(VJDocument *)document dataIsValid:(NSString *)rawData {
- (id)document:(VJDocument *)document structuredDataFromRawDataString:(NSString *)rawData {
NSError *error = nil;
id obj = [NSJSONSerialization JSONObjectWithData:[rawData dataUsingUTF8Encoding] options:NSJSONReadingAllowFragments error:&error];
// TODO: do something with error
if (error != nil) {
obj = @{@"class": error.className, @"code": [NSNumber numberWithInteger:error.code], @"domain": error.domain, @"reason":error.localizedFailureReason};
}
return [JsonElement elementWithObject:obj];
}

Expand Down

0 comments on commit 3d64ef3

Please sign in to comment.