diff options
-rw-r--r-- | Juick/APIClient.m | 3 | ||||
-rw-r--r-- | Juick/Model/User.m | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m index 28c64ca..e988edc 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -206,9 +206,10 @@ } else { NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode; if (!response || statusCode != 200) { + NSURL *url = request.URL; NSError *err = [NSError errorWithDomain:@"JuickErrorDomain" code:statusCode - userInfo:nil]; + userInfo:@{@"url": url.absoluteString}]; [[NSOperationQueue mainQueue] addOperationWithBlock:^{ callback(nil, err); }]; diff --git a/Juick/Model/User.m b/Juick/Model/User.m index f5b41f5..94b77c4 100644 --- a/Juick/Model/User.m +++ b/Juick/Model/User.m @@ -22,7 +22,8 @@ +(void) throwUnableToLogin:(UIViewController *)view error:(NSError *)error { UIAlertController *alert = [UIAlertController new]; - [alert setTitle:@"Something went wrong"]; + NSString *title = error.userInfo[@"url"] ? error.userInfo[@"url"] : @"Something went wrong"; + [alert setTitle:title]; [alert setMessage:error.localizedDescription]; [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]]; UIPopoverPresentationController *popover = [alert popoverPresentationController]; |