diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.h b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.h index 93e7404..775bd55 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.h +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.h @@ -35,6 +35,7 @@ // Returns an error given a load object and error details. Attaches session data related to the load. Important for proper logging. - (nonnull MVMCoreErrorObject *)errorForLoadObject:(nonnull MVMCoreLoadObject *)loadObject withTitle:(nullable NSString *)title message:(nullable NSString *)message code:(NSInteger)code domain:(nonnull NSString *)domain; +- (nonnull MVMCoreErrorObject *)errorForLoadObject:(nonnull MVMCoreLoadObject *)loadObject withTitle:(nullable NSString *)title message:(nullable NSString *)message messageToLog:(nullable NSString *)messageToLog code:(NSInteger)code domain:(nonnull NSString *)domain; // Returns an error given a load object and NSError. Attaches session data related to the load. Important for proper logging. - (nonnull MVMCoreErrorObject *)errorForLoadObject:(nonnull MVMCoreLoadObject *)loadObject causedBy:(nonnull NSError *)error; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index 8058ca5..a5f65c1 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -99,6 +99,10 @@ return [self attachLoadInformation:loadObject toError:[[MVMCoreErrorObject alloc] initWithTitle:title messageToLog:message code:code domain:domain location:[self errorLocationForRequest:loadObject]]]; } +- (nonnull MVMCoreErrorObject *)errorForLoadObject:(MVMCoreLoadObject *)loadObject withTitle:(NSString *)title message:(NSString *)message messageToLog:(NSString *)messageToLog code:(NSInteger)code domain:(NSString *)domain { + return [self attachLoadInformation:loadObject toError:[[MVMCoreErrorObject alloc] initWithTitle:title message:message messageToLog:messageToLog code:code domain:domain location:[self errorLocationForRequest:loadObject]]]; +} + - (nonnull MVMCoreErrorObject *)errorForLoadObject:(MVMCoreLoadObject *)loadObject causedBy:(NSError *)error { return [self attachLoadInformation:loadObject toError:[MVMCoreErrorObject createErrorObjectForNSError:error location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]]; } @@ -109,6 +113,7 @@ error.errorScreenError = YES; error.nativeDrivenErrorScreen = YES; error.silentError = NO; + error.messageToDisplay = error.messageToDisplay ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess]; } return error; } diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 680ce37..fb6bb64 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -523,10 +523,11 @@ // Display or finish if (error.errorScreenError || !loadObject.requestParameters.dontDisplayViewController) { error.silentError = NO; + loadObject.operation.alertToShow = NO; + loadObject.operation.errorForAlertToShow = nil; [MVMCoreLoggingHandler addErrorToLog:error]; [MVMCoreLoadRequestOperation displayViewController:viewController loadObject:loadObject error:error]; } else { - error.silentError = YES; [MVMCoreLoggingHandler addErrorToLog:error]; [MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:viewController errorObject:error]; } diff --git a/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m b/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m index a480f9c..f6c53bb 100644 --- a/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m +++ b/MVMCore/MVMCore/Utility/MVMCoreErrorObject.m @@ -90,7 +90,13 @@ if (errorObject) { return errorObject; } - errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[error localizedDescription] messageToLog:[error localizedFailureReason] ?: [error localizedDescription] code:[error code] domain:ErrorDomainSystem location:location]; + errorObject = [[MVMCoreErrorObject alloc] + initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] + message:[error localizedDescription] ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] + messageToLog:[error localizedFailureReason] ?: [error localizedDescription] ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess] + code:[error code] + domain:ErrorDomainSystem + location:location]; if ([error.domain isEqualToString:NSURLErrorDomain] || [error.domain isEqualToString:@"WebKitErrorDomain"]) { errorObject.systemDomain = error.domain; }