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];
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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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]) {

View File

@ -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:@""];

View File

@ -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"];

View File

@ -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;
}

View File

@ -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];

View File

@ -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;
}

View File

@ -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";