From 08e26c13ab22fd07442d2323ba98a7b6cb56dc8a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 16 Sep 2020 02:29:15 +0300 Subject: Add more url info in error alert --- Juick/Model/User.h | 2 +- Juick/Model/User.m | 4 ++-- Juick/ViewControllers/MessagesViewController.m | 2 +- Juick/ViewControllers/NewPostViewController.m | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Juick') diff --git a/Juick/Model/User.h b/Juick/Model/User.h index 344626e..4bbf332 100644 --- a/Juick/Model/User.h +++ b/Juick/Model/User.h @@ -17,6 +17,6 @@ + (User *) fromJSON:(NSDictionary *)jsonData; -+ (void) throwUnableToLogin:(UIViewController *)view error:(NSError *)error; ++ (void) throwUnableToLogin:(UIViewController *)view error:(NSError *)error path:(NSString *)path params:(NSDictionary *)params; @end diff --git a/Juick/Model/User.m b/Juick/Model/User.m index a0c34f9..f9b2990 100644 --- a/Juick/Model/User.m +++ b/Juick/Model/User.m @@ -20,11 +20,11 @@ return user; } -+(void) throwUnableToLogin:(UIViewController *)view error:(NSError *)error { ++(void) throwUnableToLogin:(UIViewController *)view error:(NSError *)error path:(NSString *)path params:(NSDictionary *)params { UIAlertController *alert = [UIAlertController new]; NSString *title = error.userInfo[@"url"] ? error.userInfo[@"url"] : @"Something went wrong"; [alert setTitle:title]; - [alert setMessage:error.localizedDescription]; + [alert setMessage:[NSString stringWithFormat:@"err: %@, path: %@, params: %@", error.localizedDescription, path, params]]; [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]]; UIPopoverPresentationController *popover = [alert popoverPresentationController]; if (popover) { diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 8fc6408..d25f438 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -35,7 +35,7 @@ NSString* const messageCellIdentifier = @"messageCell"; } [[AppDelegate shared].api pullNextFromPath:self.path params:self.params callback:^(NSArray *next, NSError *err) { if (err) { - [User throwUnableToLogin:self error:err]; + [User throwUnableToLogin:self error:err path:self.path params:self.params]; return; } NSArray *newMsgs = next; diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 8e61006..990410b 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -52,7 +52,7 @@ NSString * const ReplyPostedNotificationName = @"ReplyPosted"; }]; } else { self.navigationController.navigationItem.rightBarButtonItem.enabled = YES; - [User throwUnableToLogin:self error:err]; + [User throwUnableToLogin:self error:err path:@"postMessage" params:nil]; } }]; } else { @@ -64,7 +64,7 @@ NSString * const ReplyPostedNotificationName = @"ReplyPosted"; }]; } else { self.navigationItem.rightBarButtonItem.enabled = YES; - [User throwUnableToLogin:self error:err]; + [User throwUnableToLogin:self error:err path:@"postreply" params:nil]; } }]; } -- cgit v1.2.3