2
0

Use fullDescription for all error logging.

This commit is contained in:
Maarten Billemont 2014-09-21 23:28:50 -04:00
parent d03b1746e0
commit 9e742fa40f
11 changed files with 24 additions and 24 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit 4afc758ce467cf75f2594512e2be3125c45d640c Subproject commit 249dbb1068dae9b600f354034989b2d451573d63

View File

@ -80,7 +80,7 @@
migrationRequest.predicate = [NSPredicate predicateWithFormat:@"version_ < %d AND user == %@", self.version, user]; migrationRequest.predicate = [NSPredicate predicateWithFormat:@"version_ < %d AND user == %@", self.version, user];
NSArray *migrationSites = [moc executeFetchRequest:migrationRequest error:&error]; NSArray *migrationSites = [moc executeFetchRequest:migrationRequest error:&error];
if (!migrationSites) { if (!migrationSites) {
err( @"While looking for sites to migrate: %@", error ); err( @"While looking for sites to migrate: %@", [error fullDescription] );
return NO; return NO;
} }

View File

@ -41,7 +41,7 @@ PearlAssociatedObjectProperty( NSArray*, PaymentTransactions, paymentTransaction
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error { - (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
err( @"StoreKit request (%@) failed: %@", request, error ); err( @"StoreKit request (%@) failed: %@", request, [error fullDescription] );
} }
- (void)requestDidFinish:(SKRequest *)request { - (void)requestDidFinish:(SKRequest *)request {
@ -75,7 +75,7 @@ PearlAssociatedObjectProperty( NSArray*, PaymentTransactions, paymentTransaction
- (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error { - (void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error {
err( @"StoreKit restore failed: %@", error ); err( @"StoreKit restore failed: %@", [error fullDescription] );
} }
@end @end

View File

@ -52,7 +52,7 @@
NSError *error; NSError *error;
if (activeUser.objectID.isTemporaryID && ![activeUser.managedObjectContext obtainPermanentIDsForObjects:@[ activeUser ] error:&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; self.activeUserOID = activeUser.objectID;
} }

View File

@ -163,7 +163,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
NSInferMappingModelAutomaticallyOption : @YES, NSInferMappingModelAutomaticallyOption : @YES,
STORE_OPTIONS STORE_OPTIONS
} error:&error]) { } error:&error]) {
err( @"Failed to open store: %@", error ); err( @"Failed to open store: %@", [error fullDescription] );
[self handleCoordinatorError:error]; [self handleCoordinatorError:error];
return; return;
} }
@ -231,11 +231,11 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
NSError *error = nil; NSError *error = nil;
for (NSPersistentStore *store in self.persistentStoreCoordinator.persistentStores) { for (NSPersistentStore *store in self.persistentStoreCoordinator.persistentStores) {
if (![self.persistentStoreCoordinator removePersistentStore:store error:&error]) 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; self.persistentStoreCoordinator = nil;
if (![[NSFileManager defaultManager] removeItemAtURL:self.localStoreURL error:&error]) 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]; [self loadStore];
} }
@ -253,7 +253,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
fetchRequest.entity = entity; fetchRequest.entity = entity;
NSArray *objects = [context executeFetchRequest:fetchRequest error:&error]; NSArray *objects = [context executeFetchRequest:fetchRequest error:&error];
if (!objects) { if (!objects) {
err( @"Failed to fetch %@ objects: %@", entity, error ); err( @"Failed to fetch %@ objects: %@", entity, [error fullDescription] );
continue; continue;
} }
@ -392,7 +392,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
NSError *error = nil; NSError *error = nil;
if (site.objectID.isTemporaryID && ![context obtainPermanentIDsForObjects:@[ site ] error:&error]) 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]; [context saveToStore];
@ -424,7 +424,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
NSError *error = nil; NSError *error = nil;
if (![context obtainPermanentIDsForObjects:@[ newSite ] error:&error]) 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 deleteObject:site];
[context saveToStore]; [context saveToStore];
@ -470,7 +470,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
initWithPattern:@"^#[[:space:]]*([^:]+): (.*)" initWithPattern:@"^#[[:space:]]*([^:]+): (.*)"
options:(NSRegularExpressionOptions)0 error:&error]; options:(NSRegularExpressionOptions)0 error:&error];
if (error) { if (error) {
err( @"Error loading the header pattern: %@", error ); err( @"Error loading the header pattern: %@", [error fullDescription] );
return MPImportResultInternalError; return MPImportResultInternalError;
} }
} }
@ -484,7 +484,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
options:(NSRegularExpressionOptions)0 error:&error] options:(NSRegularExpressionOptions)0 error:&error]
]; ];
if (error) { if (error) {
err( @"Error loading the site patterns: %@", error ); err( @"Error loading the site patterns: %@", [error fullDescription] );
return MPImportResultInternalError; return MPImportResultInternalError;
} }
} }
@ -534,7 +534,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
userFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@", importUserName]; userFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@", importUserName];
NSArray *users = [context executeFetchRequest:userFetchRequest error:&error]; NSArray *users = [context executeFetchRequest:userFetchRequest error:&error];
if (!users) { if (!users) {
err( @"While looking for user: %@, error: %@", importUserName, error ); err( @"While looking for user: %@, error: %@", importUserName, [error fullDescription] );
return MPImportResultInternalError; return MPImportResultInternalError;
} }
if ([users count] > 1) { if ([users count] > 1) {
@ -621,7 +621,7 @@ PearlAssociatedObjectProperty( NSManagedObjectContext*, MainManagedObjectContext
siteFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@ AND user == %@", siteName, user]; siteFetchRequest.predicate = [NSPredicate predicateWithFormat:@"name == %@ AND user == %@", siteName, user];
NSArray *existingSites = [context executeFetchRequest:siteFetchRequest error:&error]; NSArray *existingSites = [context executeFetchRequest:siteFetchRequest error:&error];
if (!existingSites) { 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; return MPImportResultInternalError;
} }
if ([existingSites count]) { if ([existingSites count]) {

View File

@ -229,7 +229,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url] NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url]
returningResponse:&response error:&error]; returningResponse:&response error:&error];
if (error) if (error)
err( @"While reading imported sites from %@: %@", url, error ); err( @"While reading imported sites from %@: %@", url, [error fullDescription] );
if (!importedSitesData) if (!importedSitesData)
return; return;
@ -346,7 +346,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
[moc saveToStore]; [moc saveToStore];
NSError *error = nil; NSError *error = nil;
if (![moc obtainPermanentIDsForObjects:@[ newUser ] error:&error]) 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:^{ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self updateUsers]; [self updateUsers];
@ -510,7 +510,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO] ]; fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:@"lastUsed" ascending:NO] ];
NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error]; NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error];
if (!users) if (!users)
err( @"Failed to load users: %@", error ); err( @"Failed to load users: %@", [error fullDescription] );
if (![users count]) { if (![users count]) {
NSMenuItem *noUsersItem = [self.usersItem.submenu addItemWithTitle:@"No users" action:NULL keyEquivalent:@""]; NSMenuItem *noUsersItem = [self.usersItem.submenu addItemWithTitle:@"No users" action:NULL keyEquivalent:@""];

View File

@ -524,7 +524,7 @@
NSError *error = nil; NSError *error = nil;
NSArray *siteResults = [context executeFetchRequest:fetchRequest error:&error]; NSArray *siteResults = [context executeFetchRequest:fetchRequest error:&error];
if (!siteResults) { if (!siteResults) {
err( @"While fetching sites for completion: %@", error ); err( @"While fetching sites for completion: %@", [error fullDescription] );
return; return;
} }
[profiler finishJob:@"do fetch"]; [profiler finishJob:@"do fetch"];

View File

@ -66,7 +66,7 @@
NSError *error; NSError *error;
MPSiteEntity *entity = (MPSiteEntity *)[moc existingObjectWithID:_entityOID error:&error]; MPSiteEntity *entity = (MPSiteEntity *)[moc existingObjectWithID:_entityOID error:&error];
if (!entity) if (!entity)
err( @"Couldn't retrieve active site: %@", error ); err( @"Couldn't retrieve active site: %@", [error fullDescription] );
return entity; return entity;
} }

View File

@ -388,7 +388,7 @@ referenceSizeForHeaderInSection:(NSInteger)section {
[NSPredicate predicateWithFormat:@"user == %@ AND name BEGINSWITH[cd] %@", activeUserOID, query]: [NSPredicate predicateWithFormat:@"user == %@ AND name BEGINSWITH[cd] %@", activeUserOID, query]:
[NSPredicate predicateWithFormat:@"user == %@", activeUserOID]; [NSPredicate predicateWithFormat:@"user == %@", activeUserOID];
if (![self.fetchedResultsController performFetch:&error]) if (![self.fetchedResultsController performFetch:&error])
err( @"Couldn't fetch sites: %@", error ); err( @"Couldn't fetch sites: %@", [error fullDescription] );
[self.passwordCollectionView performBatchUpdates:^{ [self.passwordCollectionView performBatchUpdates:^{
[self fetchedItemsDidUpdate]; [self fetchedItemsDidUpdate];

View File

@ -692,7 +692,7 @@ referenceSizeForFooterInSection:(NSInteger)section {
]; ];
NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error]; NSArray *users = [mainContext executeFetchRequest:fetchRequest error:&error];
if (!users) { if (!users) {
err( @"Failed to load users: %@", error ); err( @"Failed to load users: %@", [error fullDescription] );
self.userIDs = nil; self.userIDs = nil;
} }

View File

@ -170,7 +170,7 @@
NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url] NSData *importedSitesData = [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:url]
returningResponse:&response error:&error]; returningResponse:&response error:&error];
if (error) if (error)
err( @"While reading imported sites from %@: %@", url, error ); err( @"While reading imported sites from %@: %@", url, [error fullDescription] );
if (!importedSitesData) if (!importedSitesData)
return; return;
@ -455,7 +455,7 @@
NSError *error = nil; NSError *error = nil;
if (![[exportedSites dataUsingEncoding:NSUTF8StringEncoding] if (![[exportedSites dataUsingEncoding:NSUTF8StringEncoding]
writeToURL:exportURL options:NSDataWritingFileProtectionComplete error:&error]) 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 { else {
self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:exportURL]; self.interactionController = [UIDocumentInteractionController interactionControllerWithURL:exportURL];
self.interactionController.UTI = @"com.lyndir.masterpassword.sites"; self.interactionController.UTI = @"com.lyndir.masterpassword.sites";