Permalink
Browse files

Proper alert if Couchbase fails to initialize.

  • Loading branch information...
1 parent 3c6d46d commit 182ca99670e745735c24c616c3479c13bc387bcc @snej snej committed Oct 11, 2011
Showing with 13 additions and 2 deletions.
  1. +13 −2 App/AppDelegate.m
View
@@ -83,8 +83,19 @@ -(void)couchbaseMobile:(CouchbaseMobile*)couchbase didStart:(NSURL*)serverURL
-(void)couchbaseMobile:(CouchbaseMobile*)couchbase failedToStart:(NSError*)error
{
- // TODO: You will probably want to improve this to at least display an alert box and quit!
- NSAssert(NO, @"Couchbase failed to initialize: %@", error);
+ NSString* message = [NSString stringWithFormat: @"Couchbase failed to initialize:\n\n%@.",
+ error.localizedDescription];
+ UIAlertView* alert = [[UIAlertView alloc] initWithTitle: @"Fatal Error"
+ message: message
+ delegate: self
+ cancelButtonTitle: @"Quit"
+ otherButtonTitles: nil];
+ [alert show];
+ [alert release];
+}
+
+- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
+ exit(0);
}
@end

0 comments on commit 182ca99

Please sign in to comment.