Merge branch 'release/10_5_1' into 'develop'
release/10_5_1 hotfix merge Co-authored-by: Kyle Matthew Hedden <kyle.hedden@verizonwireless.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/250
This commit is contained in:
commit
5ee5c39ff8
@ -132,6 +132,7 @@ public protocol MVMCoreJSONActionHandlerProtocol: MVMCoreActionHandlerProtocol {
|
||||
@objc open func defaultHandleActionError(_ error: MVMCoreErrorObject, additionalData: [AnyHashable: Any]?) {
|
||||
guard error.logError else { return }
|
||||
MVMCoreLoggingHandler.addError(toLog: error)
|
||||
error.logError = false // Further attempts to log the same error will be skipped. (Legacy action flow.)
|
||||
}
|
||||
|
||||
// MARK: - Legacy Holdovers
|
||||
|
||||
@ -40,5 +40,6 @@ typedef NS_ENUM(NSInteger, ErrorCode) {
|
||||
ErrorCodeSSL,//23
|
||||
ErrorCodeNoViewControllerToPresentOn,//24
|
||||
ErrorCodeNoErrorPageSent, //25
|
||||
ErrorCodeFontNotFound //26
|
||||
ErrorCodeFontNotFound, //26
|
||||
ErrorCodePoorPerformance //27
|
||||
};
|
||||
|
||||
@ -9,6 +9,10 @@
|
||||
#import "MVMCoreErrorConstants.h"
|
||||
|
||||
// Error Domains
|
||||
|
||||
/// Communication breakdowns.
|
||||
NSString * const ErrorDomainSystem = @"ErrorDomainSystem";
|
||||
/// Any sort of native error not due to server directives.
|
||||
NSString * const ErrorDomainNative = @"ErrorDomainNative";
|
||||
/// Specific errors defined by the server.
|
||||
NSString * const ErrorDomainServer = @"ErrorDomainServer";
|
||||
|
||||
@ -33,6 +33,16 @@
|
||||
// Returns the error location for the given requesting object and page type and modules. Important for proper logging.
|
||||
- (nonnull NSString *)errorLocationForRequest:(nonnull id)requestingObject pageType:(nonnull NSString *)pageType modules:(nonnull NSString *)modules;
|
||||
|
||||
// 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;
|
||||
|
||||
// Decorates an error object given a load object.
|
||||
- (nonnull MVMCoreErrorObject *)attachLoadInformation:(nonnull MVMCoreLoadObject *)loadObject toError:(nonnull MVMCoreErrorObject *)error;
|
||||
|
||||
#pragma mark - Request Functions.
|
||||
|
||||
- (void)setHeadersForRequest:(nonnull NSMutableURLRequest *)request requestParameters:(nonnull MVMCoreRequestParameters *)requestParameters;
|
||||
|
||||
@ -95,9 +95,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (nonnull MVMCoreErrorObject *)errorForLoadObject:(MVMCoreLoadObject *)loadObject withTitle:(NSString *)title message:(NSString *)message code:(NSInteger)code domain:(NSString *)domain {
|
||||
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]]];
|
||||
}
|
||||
|
||||
- (nonnull MVMCoreErrorObject *)attachLoadInformation:(MVMCoreLoadObject *)loadObject toError:(MVMCoreErrorObject *)error {
|
||||
// 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;
|
||||
error.messageToDisplay = error.messageToDisplay ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess];
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
- (nonnull NSString *)errorLocationForRequest:(nonnull MVMCoreLoadObject *)loadObject {
|
||||
|
||||
return [self errorLocationForRequest:loadObject.delegateObject.loadDelegate pageType:loadObject.requestParameters.pageType modules:[NSString stringWithFormat:@"%@",loadObject.requestParameters.modules]];
|
||||
return [self errorLocationForRequest:loadObject.delegateObject.loadDelegate
|
||||
pageType:loadObject.requestParameters.pageType
|
||||
modules:[NSString stringWithFormat:@"%@", loadObject.requestParameters.modules]];
|
||||
}
|
||||
|
||||
- (nonnull NSString *)errorLocationForRequest:(nonnull id)requestingObject pageType:(nonnull NSString *)pageType modules:(nonnull NSString *)modules {
|
||||
@ -349,7 +373,7 @@
|
||||
if (!jsonObject) {
|
||||
|
||||
// Error serializing json.
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] messageToLog:[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] code:ErrorCodeParsingJSON domain:ErrorDomainNative location:locationForError];
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] messageToLog:[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] code:ErrorCodeParsingJSON domain:ErrorDomainSystem location:locationForError];
|
||||
} else {
|
||||
|
||||
// Uncomment to get the raw UTF-8 string response from server before it is parsed. Useful for identifying issues such as duplicate definitions which are removed after parsing. (Also, be careful of parsing tools such as jsoneditoronline.org which will autoresolve some of these issues as well.)
|
||||
@ -362,7 +386,7 @@
|
||||
}
|
||||
} else {
|
||||
// Empty response.
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeEmptyResponse domain:ErrorDomainNative location:locationForError];
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeEmptyResponse domain:ErrorDomainSystem location:locationForError];
|
||||
}
|
||||
} else if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(createErrorObjectForRequestNSError:forRequest:location:)]) {
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
@property (nullable, strong, nonatomic) MVMCoreLoadObject *loadObject;
|
||||
@property (nullable, strong, nonatomic) NSDictionary *dataForPage;
|
||||
@property (nullable, strong, nonatomic) DelegateObject *delegateObject;
|
||||
@property (nullable, nonatomic, readonly) NSURLSessionTask *sessionTask;
|
||||
@property (nullable, nonatomic, readonly) NSString *finalLoadSource;
|
||||
@property (nonatomic) BOOL backgroundLoad;
|
||||
@property (nonatomic, getter=areDependenciesAdded) BOOL dependenciesAdded;
|
||||
|
||||
@ -291,12 +291,13 @@
|
||||
} else {
|
||||
|
||||
// Error json not correct format.
|
||||
MVMCoreErrorObject *errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
MVMCoreErrorObject *errorObject = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainSystem];
|
||||
[MVMCoreLoadRequestOperation loadAbortedWithError:errorObject loadObject:loadObject];
|
||||
}
|
||||
} else {
|
||||
|
||||
// Error with the request/response
|
||||
[[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:error];
|
||||
[MVMCoreLoadRequestOperation loadAbortedWithError:error loadObject:loadObject];
|
||||
}
|
||||
}];
|
||||
@ -498,6 +499,7 @@
|
||||
if (error.errorScreenError && !error.nativeDrivenErrorScreen && loadObject.pageType.length == 0) {
|
||||
error.logError = YES;
|
||||
error.errorScreenError = NO;
|
||||
error.silentError = NO;
|
||||
error.location = [NSString stringWithFormat:@"%li-%@",(long)ErrorCodeNoErrorPageSent,error.location];
|
||||
[MVMCoreLoadRequestOperation handleError:error loadObject:loadObject showAlertForErrorIfApplicable:YES];
|
||||
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error];
|
||||
@ -517,9 +519,16 @@
|
||||
if (viewController) {
|
||||
|
||||
// Display or finish
|
||||
if (error.errorScreenError || !loadObject.requestParameters.dontDisplayViewController) {
|
||||
if (error.errorScreenError) {
|
||||
error.silentError = NO;
|
||||
if (error.nativeDrivenErrorScreen) {
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
}
|
||||
[MVMCoreLoadRequestOperation displayViewController:viewController loadObject:loadObject error:error];
|
||||
} else if (!loadObject.requestParameters.dontDisplayViewController) {
|
||||
[MVMCoreLoadRequestOperation displayViewController:viewController loadObject:loadObject error:error];
|
||||
} else {
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:viewController errorObject:error];
|
||||
}
|
||||
} else if (!loadObject.requestParameters.shouldNotGoToServerOnCacheFail && (loadObject.pageDataFromCache || loadObject.moduleDataFromCache)) {
|
||||
@ -531,7 +540,7 @@
|
||||
loadObject.operation.errorForAlertToShow = nil;
|
||||
[loadObject.operation main];
|
||||
} else {
|
||||
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
// Otherwise the request is finished.
|
||||
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error];
|
||||
}
|
||||
@ -571,7 +580,8 @@
|
||||
} else if ([ValueTypeErrorScreen isEqualToString:type]) {
|
||||
|
||||
// Error Screen, abort the load and handle the screen if necessary
|
||||
MVMCoreErrorObject *error = [MVMCoreErrorObject createErrorObjectForErrorInfo:loadObject.responseInfoMap location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
MVMCoreErrorObject *error = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:[MVMCoreErrorObject createErrorObjectForErrorInfo:loadObject.responseInfoMap location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]];
|
||||
|
||||
[MVMCoreLoadRequestOperation loadAbortedWithError:error loadObject:loadObject];
|
||||
} else {
|
||||
|
||||
@ -582,7 +592,7 @@
|
||||
} else {
|
||||
// Check for controller specific errors.
|
||||
BOOL shouldContinue;
|
||||
MVMCoreErrorObject *error = [MVMCoreErrorObject createErrorObjectForErrorInfo:loadObject.responseInfoMap location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
MVMCoreErrorObject *error = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:[MVMCoreErrorObject createErrorObjectForErrorInfo:loadObject.responseInfoMap location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]];
|
||||
if ([loadObject.delegateObject.loadDelegate respondsToSelector:@selector(checkForDelegateSpecificErrors:loadObject:completionHandler:)]) {
|
||||
shouldContinue = [loadObject.delegateObject.loadDelegate checkForDelegateSpecificErrors:error loadObject:loadObject completionHandler:completionHandler];
|
||||
} else {
|
||||
@ -614,16 +624,22 @@
|
||||
}
|
||||
|
||||
if (obj && [obj isKindOfClass:[NSDictionary class]]) {
|
||||
|
||||
NSDictionary *responseInfo = [obj dict:KeyResponseInfo];
|
||||
if (![ValueTypeSuccess isEqualToString:[responseInfo string:KeyType]]) {
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[responseInfo stringForKey:KeyErrorHeading] message:[responseInfo stringForKey:KeyUserMessage] messageToLog:[responseInfo stringForKey:KeyMessage] code:[[responseInfo string:KeyCode] integerValue] domain:ErrorDomainServer location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
errorObject = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:
|
||||
[[MVMCoreErrorObject alloc]
|
||||
initWithTitle:[responseInfo stringForKey:KeyErrorHeading]
|
||||
message:[responseInfo stringForKey:KeyUserMessage]
|
||||
messageToLog:[responseInfo stringForKey:KeyMessage]
|
||||
code:[[responseInfo string:KeyCode] integerValue]
|
||||
domain:ErrorDomainServer
|
||||
location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]];
|
||||
}
|
||||
|
||||
// Caches each dictionary from the array.
|
||||
[[MVMCoreCache sharedCache] addModuleToCache:obj module:key queue:nil waitUntilFinished:YES completionBlock:NULL];
|
||||
} else {
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:nil message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
errorObject = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:nil message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainSystem];
|
||||
}
|
||||
|
||||
if (errorObject) {
|
||||
@ -666,10 +682,10 @@
|
||||
if (pageType) {
|
||||
[[MVMCoreCache sharedCache] addPageToCache:obj pageType:pageType queue:nil waitUntilFinished:YES completionBlock:NULL];
|
||||
} else {
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoPageType domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
errorObject = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoPageType domain:ErrorDomainNative];
|
||||
}
|
||||
} else {
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:nil message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
errorObject = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:nil message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainNative];
|
||||
}
|
||||
|
||||
// Logs the error.
|
||||
@ -713,7 +729,7 @@
|
||||
}
|
||||
} else {
|
||||
// Couldn't initialize view controller, serious error.
|
||||
error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeInitViewController domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
|
||||
error = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeInitViewController domain:ErrorDomainNative];
|
||||
}
|
||||
|
||||
[MVMCoreLoadRequestOperation handleShouldContinue:shouldContinue error:error loadObject:loadObject errorBlock:NULL continueBlock:^{
|
||||
@ -742,17 +758,19 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Logs the error.
|
||||
if (error.logError) {
|
||||
[MVMCoreLoggingHandler addErrorToLog:error];
|
||||
}
|
||||
|
||||
MVMCoreLog(@"Error: %@ %@ %@ %@ %@",[error stringErrorCode], error.domain, error.location,error.messageToDisplay, error.messageToLog);
|
||||
|
||||
if (showAlertForErrorIfApplicable && (!loadObject.operation.backgroundLoad || loadObject.requestParameters.allowAlertsIfBackgroundRequest) && !loadObject.requestParameters.handleErrorsSilently && !error.silentError && !error.errorScreenError) {
|
||||
|
||||
// Show alert for error.
|
||||
[MVMCoreLoadRequestOperation createAndShowAlertForLoadObject:loadObject error:error delegateObject:loadObject.operation.delegateObject];
|
||||
} else {
|
||||
error.silentError = !error.errorScreenError && !error.nativeDrivenErrorScreen;
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -592,6 +592,10 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
|
||||
//system stores cache based datatask and check cache based on response,
|
||||
//need to manually store cache for response
|
||||
[sharedCache storeCachedResponse:cachedReponse forRequest:request];
|
||||
} else if (error) {
|
||||
[MVMCoreLoggingHandler addErrorToLog:[MVMCoreErrorObject createErrorObjectForNSError:error location:@"MVMCoreCache->downloadImage"]];
|
||||
} else {
|
||||
[MVMCoreLoggingHandler addErrorToLog:[[MVMCoreErrorObject alloc] initWithTitle:nil messageToLog:[NSString stringWithFormat:@"Failed to download image %@", request.URL.absoluteString] code:0 domain:ErrorDomainSystem location:@"MVMCoreCache->downloadImage"]];
|
||||
}
|
||||
if (isGif) {
|
||||
[self checkImage:nil imageData:data fallbackImage:fallbackImageName completionHandler:completionHandler];
|
||||
|
||||
@ -22,6 +22,11 @@
|
||||
@property (nullable, strong, nonatomic) NSString *systemDomain;
|
||||
@property (nonatomic) NSInteger code;
|
||||
@property (nonatomic) UIApplicationState applicationState;
|
||||
@property (nullable, strong, nonatomic) NSString *sessionId;
|
||||
@property (nullable, strong, nonatomic) NSString *requestId;
|
||||
@property (nullable, strong, nonatomic) NSString *requestUrl;
|
||||
@property (nonatomic, assign) NSInteger httpStatusCode;
|
||||
@property (nullable, strong, nonatomic) NSDictionary *serverResponseInfo;
|
||||
|
||||
// For the crash log.
|
||||
@property (nullable, strong, nonatomic) NSDictionary *crashLog;
|
||||
|
||||
@ -28,22 +28,11 @@
|
||||
self.domain = domain;
|
||||
self.location = location;
|
||||
self.date = [NSDate date];
|
||||
self.silentError = YES;
|
||||
self.logError = YES;
|
||||
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
|
||||
self.applicationState = [UIApplication sharedApplication].applicationState;
|
||||
}];
|
||||
|
||||
// We don't log server errors.
|
||||
if (![domain isEqualToString:ErrorDomainServer]) {
|
||||
self.logError = YES;
|
||||
|
||||
// Native and system errors have an error screen.
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
self.errorScreenError = YES;
|
||||
self.nativeDrivenErrorScreen = YES;
|
||||
}
|
||||
} else {
|
||||
self.logError = NO;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -58,21 +47,11 @@
|
||||
self.domain = domain;
|
||||
self.location = location;
|
||||
self.date = [NSDate date];
|
||||
self.silentError = YES;
|
||||
self.logError = YES;
|
||||
[MVMCoreDispatchUtility performSyncBlockOnMainThread:^{
|
||||
self.applicationState = [UIApplication sharedApplication].applicationState;
|
||||
}];
|
||||
// We don't log server errors.
|
||||
if (![domain isEqualToString:ErrorDomainServer]) {
|
||||
self.logError = YES;
|
||||
|
||||
// Native and system errors have an error screen.
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
self.errorScreenError = YES;
|
||||
self.nativeDrivenErrorScreen = YES;
|
||||
}
|
||||
} else {
|
||||
self.logError = NO;
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -91,12 +70,12 @@
|
||||
NSInteger errorCode = [[errorInfo string:KeyCode] integerValue];
|
||||
NSString *type = [errorInfo string:KeyType];
|
||||
if (![ValueTypeSuccess isEqualToString:type]) {
|
||||
|
||||
NSString *title = [errorInfo string:KeyErrorHeading] ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle];
|
||||
NSString *message = [errorInfo string:KeyUserMessage] ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess];
|
||||
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:title message:message messageToLog:[errorInfo string:KeyMessage] code:errorCode domain:ErrorDomainServer location:location];
|
||||
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:title message:message messageToLog:[errorInfo string:KeyMessage] ?: @"ResponseInfo type is not Success." code:errorCode domain:ErrorDomainServer location:location];
|
||||
error.silentError = NO;
|
||||
error.serverResponseInfo = errorInfo;
|
||||
if ([ValueTypeErrorScreen isEqualToString:type]) {
|
||||
|
||||
// If this is a server error screen, there should be no additional alerts... It will be handled by the load handler.
|
||||
error.errorScreenError = YES;
|
||||
}
|
||||
@ -111,14 +90,17 @@
|
||||
if (errorObject) {
|
||||
return errorObject;
|
||||
}
|
||||
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[error localizedDescription] messageToLog:[error description] code:[error code] domain:ErrorDomainSystem location:location];
|
||||
if ([error.domain isEqualToString:NSURLErrorDomain]) {
|
||||
errorObject = [[MVMCoreErrorObject alloc]
|
||||
initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle]
|
||||
message:[error localizedDescription] ?: [MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorUnableToProcess]
|
||||
messageToLog:[error description]
|
||||
code:[error code]
|
||||
domain:ErrorDomainSystem
|
||||
location:location];
|
||||
if ([error.domain isEqualToString:NSURLErrorDomain] || [error.domain isEqualToString:@"WebKitErrorDomain"]) {
|
||||
errorObject.systemDomain = error.domain;
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getNativeScreenForRequestError:requestObject:)]) {
|
||||
errorObject.errorScreenError = YES;
|
||||
errorObject.nativeDrivenErrorScreen = YES;
|
||||
}
|
||||
}
|
||||
errorObject.requestUrl = error.userInfo[NSURLErrorFailingURLStringErrorKey];
|
||||
return errorObject;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user