Crash fix for missing UserMessage. Suppress alertToShow dialogs when a native error screen is present. Pipe template parsing description messages to error object. Provide a messageToLog for invalid openURL calls.

This commit is contained in:
Kyle Matthew Hedden 2023-03-06 15:58:33 -05:00
parent 3b85ca1ff8
commit 7a38ecf62b
4 changed files with 15 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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