From 9e742fa40fb86af8b1627b869d7fb253a97f42c8 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 21 Sep 2014 23:28:50 -0400 Subject: [PATCH] Use fullDescription for all error logging. --- External/Pearl | 2 +- MasterPassword/ObjC/MPAlgorithmV0.m | 2 +- MasterPassword/ObjC/MPAppDelegate_InApp.m | 4 ++-- MasterPassword/ObjC/MPAppDelegate_Shared.m | 2 +- MasterPassword/ObjC/MPAppDelegate_Store.m | 20 +++++++++---------- MasterPassword/ObjC/Mac/MPMacAppDelegate.m | 6 +++--- .../ObjC/Mac/MPPasswordWindowController.m | 2 +- MasterPassword/ObjC/Mac/MPSiteModel.m | 2 +- .../ObjC/iOS/MPPasswordsViewController.m | 2 +- .../ObjC/iOS/MPUsersViewController.m | 2 +- MasterPassword/ObjC/iOS/MPiOSAppDelegate.m | 4 ++-- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/External/Pearl b/External/Pearl index 4afc758c..249dbb10 160000 --- a/External/Pearl +++ b/External/Pearl @@ -1 +1 @@ -Subproject commit 4afc758ce467cf75f2594512e2be3125c45d640c +Subproject commit 249dbb1068dae9b600f354034989b2d451573d63 diff --git a/MasterPassword/ObjC/MPAlgorithmV0.m b/MasterPassword/ObjC/MPAlgorithmV0.m index 360daafc..396ae937 100644 --- a/MasterPassword/ObjC/MPAlgorithmV0.m +++ b/MasterPassword/ObjC/MPAlgorithmV0.m @@ -80,7 +80,7 @@ migrationRequest.predicate = [NSPredicate predicateWithFormat:@"version_ < %d AND user == %@", self.version, user]; NSArray *migrationSites = [moc executeFetchRequest:migrationRequest error:&error]; if (!migrationSites) { - err( @"While looking for sites to migrate: %@", error ); + err( @"While looking for sites to migrate: %@", [error fullDescription] ); return NO; } diff --git a/MasterPassword/ObjC/MPAppDelegate_InApp.m b/MasterPassword/ObjC/MPAppDelegate_InApp.m index 0c25c55b..d5782c1a 100644 --- a/MasterPassword/ObjC/MPAppDelegate_InApp.m +++ b/MasterPassword/ObjC/MPAppDelegate_InApp.m @@ -41,7 +41,7 @@ PearlAssociatedObjectProperty( NSArray*, PaymentTransactions, paymentTransaction - (void)request:(SKRequest *)request didFailWithError:(NSError *)error { - err( @"StoreKit request (%@) failed: %@", request, error ); + err( @"StoreKit request (%@) failed: %@", request, [error fullDescription] ); } - (void)requestDidFinish:(SKRequest *)request { @@ -75,7 +75,7 @@ PearlAssociatedObjectProperty( NSArray*, PaymentTransactions, paymentTransaction - (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error { - err( @"StoreKit restore failed: %@", error ); + err( @"StoreKit restore failed: %@", [error fullDescription] ); } @end diff --git a/MasterPassword/ObjC/MPAppDelegate_Shared.m b/MasterPassword/ObjC/MPAppDelegate_Shared.m index 6f7836b5..463aeaf2 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Shared.m +++ b/MasterPassword/ObjC/MPAppDelegate_Shared.m @@ -52,7 +52,7 @@ NSError *error; if (activeUser.objectID.isTemporaryID && ![activeUser.managedObjectContext obtainPermanentIDsForObjects:@[ activeUser ] error:&error]) - err(@"Failed to obtain a permanent object ID after setting active user: %@", error); + err(@"Failed to obtain a permanent object ID after setting active user: %@", [error fullDescription]); self.activeUserOID = activeUser.objectID; } diff --git a/MasterPassword/ObjC/MPAppDelegate_Store.m b/MasterPassword/ObjC/MPAppDelegate_Store.m index ed3b42e9..6c80f7ea 100644 --- a/MasterPassword/ObjC/MPAppDelegate_Store.m +++ b/MasterPassword/ObjC/MPAppDelegate_Store.m @@ -163,7 +163,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext NSInferMappingModelAutomaticallyOption : @YES, STORE_OPTIONS } error:&error]) { - err( @"Failed to open store: %@", error ); + err( @"Failed to open store: %@", [error fullDescription] ); [self handleCoordinatorError:error]; return; } @@ -231,11 +231,11 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext NSError *error = nil; for (NSPersistentStore *store in self.persistentStoreCoordinator.persistentStores) { if (![self.persistentStoreCoordinator removePersistentStore:store error:&error]) - err( @"Couldn't remove persistence store from coordinator: %@", error ); + err( @"Couldn't remove persistence store from coordinator: %@", [error fullDescription] ); } self.persistentStoreCoordinator = nil; if (![[NSFileManager defaultManager] removeItemAtURL:self.localStoreURL error:&error]) - err( @"Couldn't remove persistence store at URL %@: %@", self.localStoreURL, error ); + err( @"Couldn't remove persistence store at URL %@: %@", self.localStoreURL, [error fullDescription] ); [self loadStore]; } @@ -253,7 +253,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext fetchRequest.entity = entity; NSArray *objects = [context executeFetchRequest:fetchRequest error:&error]; if (!objects) { - err( @"Failed to fetch %@ objects: %@", entity, error ); + err( @"Failed to fetch %@ objects: %@", entity, [error fullDescription] ); continue; } @@ -392,7 +392,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext NSError *error = nil; if (site.objectID.isTemporaryID && ![context obtainPermanentIDsForObjects:@[ site ] error:&error]) - err( @"Failed to obtain a permanent object ID after creating new site: %@", error ); + err( @"Failed to obtain a permanent object ID after creating new site: %@", [error fullDescription] ); [context saveToStore]; @@ -424,7 +424,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext NSError *error = nil; if (![context obtainPermanentIDsForObjects:@[ newSite ] error:&error]) - err( @"Failed to obtain a permanent object ID after changing object type: %@", error ); + err( @"Failed to obtain a permanent object ID after changing object type: %@", [error fullDescription] ); [context deleteObject:site]; [context saveToStore]; @@ -470,7 +470,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext initWithPattern:@"^#[[:space:]]*([^:]+): (.*)" options:(NSRegularExpressionOptions)0 error:&error]; if (error) { - err( @"Error loading the header pattern: %@", error ); + err( @"Error loading the header pattern: %@", [error fullDescription] ); return MPImportResultInternalError; } } @@ -484,7 +484,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext options:(NSRegularExpressionOptions)0 error:&error] ]; if (error) { - err( @"Error loading the site patterns: %@", error ); + err( @"Error loading the site patterns: %@", [error fullDescription] ); return MPImportResultInternalError; } } @@ -534,7 +534,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext userFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@", importUserName]; NSArray *users = [context executeFetchRequest:userFetchRequest error:&error]; if (!users) { - err( @"While looking for user: %@, error: %@", importUserName, error ); + err( @"While looking for user: %@, error: %@", importUserName, [error fullDescription] ); return MPImportResultInternalError; } if ([users count] > 1) { @@ -621,7 +621,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext siteFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@ AND user == %@", siteName, user]; NSArray *existingSites = [context executeFetchRequest:siteFetchRequest error:&error]; if (!existingSites) { - err( @"Lookup of existing sites failed for site: %@, user: %@, error: %@", siteName, user.userID, error ); + err( @"Lookup of existing sites failed for site: %@, user: %@, error: %@", siteName, user.userID, [error fullDescription] ); return MPImportResultInternalError; } if ([existingSites count]) { diff --git a/MasterPassword/ObjC/Mac/MPMacAppDelegate.m b/MasterPassword/ObjC/Mac/MPMacAppDelegate.m index b00a4ca1..5efa2da2 100644 --- a/MasterPassword/ObjC/Mac/MPMacAppDelegate.m +++ b/MasterPassword/ObjC/Mac/MPMacAppDelegate.m @@ -229,7 +229,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url] returningResponse:&response error:&error]; if (error) - err( @"While reading imported sites from %@: %@", url, error ); + err( @"While reading imported sites from %@: %@", url, [error fullDescription] ); if (!importedSitesData) return; @@ -346,7 +346,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven [moc saveToStore]; NSError *error = nil; if (![moc obtainPermanentIDsForObjects:@[ newUser ] error:&error]) - err( @"Failed to obtain permanent object ID for new user: %@", error ); + err( @"Failed to obtain permanent object ID for new user: %@", [error fullDescription] ); [[NSOperationQueue mainQueue] addOperationWithBlock:^{ [self updateUsers]; @@ -510,7 +510,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO] ]; NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error]; if (!users) - err( @"Failed to load users: %@", error ); + err( @"Failed to load users: %@", [error fullDescription] ); if (![users count]) { NSMenuItem *noUsersItem = [self.usersItem.submenu addItemWithTitle:@"No users" action:NULL keyEquivalent:@""]; diff --git a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m index 0a1db761..ee0e5453 100644 --- a/MasterPassword/ObjC/Mac/MPPasswordWindowController.m +++ b/MasterPassword/ObjC/Mac/MPPasswordWindowController.m @@ -524,7 +524,7 @@ NSError *error = nil; NSArray *siteResults = [context executeFetchRequest:fetchRequest error:&error]; if (!siteResults) { - err( @"While fetching sites for completion: %@", error ); + err( @"While fetching sites for completion: %@", [error fullDescription] ); return; } [profiler finishJob:@"do fetch"]; diff --git a/MasterPassword/ObjC/Mac/MPSiteModel.m b/MasterPassword/ObjC/Mac/MPSiteModel.m index 604ed383..a6299611 100644 --- a/MasterPassword/ObjC/Mac/MPSiteModel.m +++ b/MasterPassword/ObjC/Mac/MPSiteModel.m @@ -66,7 +66,7 @@ NSError *error; MPSiteEntity *entity = (MPSiteEntity *)[moc existingObjectWithID:_entityOID error:&error]; if (!entity) - err( @"Couldn't retrieve active site: %@", error ); + err( @"Couldn't retrieve active site: %@", [error fullDescription] ); return entity; } diff --git a/MasterPassword/ObjC/iOS/MPPasswordsViewController.m b/MasterPassword/ObjC/iOS/MPPasswordsViewController.m index de22a44f..6389ac2c 100644 --- a/MasterPassword/ObjC/iOS/MPPasswordsViewController.m +++ b/MasterPassword/ObjC/iOS/MPPasswordsViewController.m @@ -388,7 +388,7 @@ referenceSizeForHeaderInSection:(NSInteger)section { [NSPredicate predicateWithFormat:@"user == %@ AND name BEGINSWITH[cd] %@", activeUserOID, query]: [NSPredicate predicateWithFormat:@"user == %@", activeUserOID]; if (![self.fetchedResultsController performFetch:&error]) - err( @"Couldn't fetch sites: %@", error ); + err( @"Couldn't fetch sites: %@", [error fullDescription] ); [self.passwordCollectionView performBatchUpdates:^{ [self fetchedItemsDidUpdate]; diff --git a/MasterPassword/ObjC/iOS/MPUsersViewController.m b/MasterPassword/ObjC/iOS/MPUsersViewController.m index c81855ac..7bb88403 100644 --- a/MasterPassword/ObjC/iOS/MPUsersViewController.m +++ b/MasterPassword/ObjC/iOS/MPUsersViewController.m @@ -692,7 +692,7 @@ referenceSizeForFooterInSection:(NSInteger)section { ]; NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error]; if (!users) { - err( @"Failed to load users: %@", error ); + err( @"Failed to load users: %@", [error fullDescription] ); self.userIDs = nil; } diff --git a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m index 6d02c472..423fab83 100644 --- a/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m +++ b/MasterPassword/ObjC/iOS/MPiOSAppDelegate.m @@ -170,7 +170,7 @@ NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url] returningResponse:&response error:&error]; if (error) - err( @"While reading imported sites from %@: %@", url, error ); + err( @"While reading imported sites from %@: %@", url, [error fullDescription] ); if (!importedSitesData) return; @@ -455,7 +455,7 @@ NSError *error = nil; if (![[exportedSites dataUsingEncoding:NSUTF8StringEncoding] writeToURL:exportURL options:NSDataWritingFileProtectionComplete error:&error]) - err( @"Failed to write export data to URL %@: %@", exportURL, error ); + err( @"Failed to write export data to URL %@: %@", exportURL, [error fullDescription] ); else { self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:exportURL]; self.interactionController.UTI = @"com.lyndir.masterpassword.sites";