Silence most errors. Push getNativeScreenForRequestError to LoadHandler decoration. Native error screen error message handling.
This commit is contained in:
parent
52883a534b
commit
56857f187b
@ -104,7 +104,13 @@
|
||||
}
|
||||
|
||||
- (nonnull MVMCoreErrorObject *)attachLoadInformation:(MVMCoreLoadObject *)loadObject toError:(MVMCoreErrorObject *)error {
|
||||
return error; // For now, just exposed for overriding.
|
||||
// Native and system errors have an error screen.
|
||||
if (![error.domain isEqualToString:ErrorDomainServer] && [[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
error.errorScreenError = YES;
|
||||
error.nativeDrivenErrorScreen = YES;
|
||||
error.silentError = NO;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
- (nonnull NSString *)errorLocationForRequest:(nonnull MVMCoreLoadObject *)loadObject {
|
||||
|
||||
@ -297,6 +297,7 @@
|
||||
} else {
|
||||
|
||||
// Error with the request/response
|
||||
[[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:error];
|
||||
[MVMCoreLoadRequestOperation loadAbortedWithError:error loadObject:loadObject];
|
||||
}
|
||||
}];
|
||||
@ -521,8 +522,12 @@
|
||||
|
||||
// Display or finish
|
||||
if (error.errorScreenError || !loadObject.requestParameters.dontDisplayViewController) {
|
||||
error.silentError = NO;
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
[MVMCoreLoadRequestOperation displayViewController:viewController loadObject:loadObject error:error];
|
||||
} else {
|
||||
error.silentError = YES;
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:viewController errorObject:error];
|
||||
}
|
||||
} else if (!loadObject.requestParameters.shouldNotGoToServerOnCacheFail && (loadObject.pageDataFromCache || loadObject.moduleDataFromCache)) {
|
||||
@ -534,7 +539,8 @@
|
||||
loadObject.operation.errorForAlertToShow = nil;
|
||||
[loadObject.operation main];
|
||||
} else {
|
||||
|
||||
error.silentError = YES;
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
// Otherwise the request is finished.
|
||||
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error];
|
||||
}
|
||||
@ -759,11 +765,11 @@
|
||||
// Show alert for error.
|
||||
[MVMCoreLoadRequestOperation createAndShowAlertForLoadObject:loadObject error:error delegateObject:loadObject.operation.delegateObject];
|
||||
} else {
|
||||
error.silentError = YES;
|
||||
error.silentError = !error.errorScreenError && !error.nativeDrivenErrorScreen;
|
||||
}
|
||||
|
||||
// Logs the error.
|
||||
if (error.logError) {
|
||||
// Logs the error. If its a native driven error screen postpone until the native screen is define with its messaging.
|
||||
if (error.logError && !error.nativeDrivenErrorScreen) {
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,18 +28,11 @@
|
||||
self.domain = domain;
|
||||
self.location = location;
|
||||
self.date = [NSDate date];
|
||||
self.silentError = YES; // TODO: Hold on this. Messes with server errors.
|
||||
self.silentError = YES;
|
||||
self.logError = YES;
|
||||
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
|
||||
self.applicationState = [UIApplication sharedApplication].applicationState;
|
||||
}];
|
||||
|
||||
// Native and system errors have an error screen.
|
||||
if (![domain isEqualToString:ErrorDomainServer] && [[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
self.errorScreenError = YES;
|
||||
self.nativeDrivenErrorScreen = YES;
|
||||
self.silentError = NO;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -54,18 +47,11 @@
|
||||
self.domain = domain;
|
||||
self.location = location;
|
||||
self.date = [NSDate date];
|
||||
self.silentError = YES; // TODO: Hold on this. Messes with server errors.
|
||||
self.silentError = YES;
|
||||
self.logError = YES;
|
||||
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
|
||||
self.applicationState = [UIApplication sharedApplication].applicationState;
|
||||
}];
|
||||
|
||||
// Native and system errors have an error screen.
|
||||
if (![domain isEqualToString:ErrorDomainServer] && [[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
self.errorScreenError = YES;
|
||||
self.nativeDrivenErrorScreen = YES;
|
||||
self.silentError = NO;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -104,13 +90,9 @@
|
||||
if (errorObject) {
|
||||
return errorObject;
|
||||
}
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[error localizedDescription] messageToLog:[error description] code:[error code] domain:ErrorDomainSystem location:location];
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[error localizedDescription] messageToLog:[error localizedFailureReason] ?: [error localizedDescription] code:[error code] domain:ErrorDomainSystem location:location];
|
||||
if ([error.domain isEqualToString:NSURLErrorDomain]) {
|
||||
errorObject.systemDomain = error.domain;
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
errorObject.errorScreenError = YES;
|
||||
errorObject.nativeDrivenErrorScreen = YES;
|
||||
}
|
||||
}
|
||||
return errorObject;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user