adding logs for testing no page error

This commit is contained in:
Khan, Arshad 2021-08-03 13:52:14 +05:30
parent b7fe17d564
commit 09803cb411

View File

@ -166,13 +166,14 @@
// Can continue loading with the page. // Can continue loading with the page.
[MVMCoreLoadRequestOperation handleLoadObject:loadObject error:error]; [MVMCoreLoadRequestOperation handleLoadObject:loadObject error:error];
} else if (loadObject.operation.backgroundLoad || loadObject.requestParameters.noViewControllerToLoad || ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(hasContentToShow:error:)] && [[MVMCoreObject sharedInstance].globalLoadDelegate hasContentToShow:loadObject error:error])) { } else if (loadObject.operation.backgroundLoad || loadObject.requestParameters.noViewControllerToLoad || ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(hasContentToShow:error:)] && [[MVMCoreObject sharedInstance].globalLoadDelegate hasContentToShow:loadObject error:error]) || (loadObject.pageType.length == 0 && [[loadObject.responseInfoMap stringForKey:KeyType] isEqualToString:ValueTypeSuccess])) {
MVMCoreLog(@"handling no page Error gracefully1");
// handle gracefully even if no pageType/page in response, but success response info provided
// Something to show, or nothing was expected to show, can finish. // Something to show, or nothing was expected to show, can finish.
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error]; [MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error];
} else { } else {
MVMCoreLog(@"no page Error: ");
// Error, foreground request with no page, alert, action, or anything else to show. Abort with error. // Error, foreground request with no alert, action, or anything else to show. Abort with error.
MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoPageType domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]; MVMCoreErrorObject *error = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoPageType domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
[MVMCoreLoadRequestOperation loadAbortedWithError:error loadObject:loadObject]; [MVMCoreLoadRequestOperation loadAbortedWithError:error loadObject:loadObject];
} }
@ -499,6 +500,7 @@
// If the server told us there is an error screen but did not provide the page, show a critical error and log so we can have them fix it. // If the server told us there is an error screen but did not provide the page, show a critical error and log so we can have them fix it.
if (error.errorScreenError && !error.nativeDrivenErrorScreen && loadObject.pageType.length == 0) { if (error.errorScreenError && !error.nativeDrivenErrorScreen && loadObject.pageType.length == 0) {
MVMCoreLog(@"handling no page Error gracefully2");
// do not throw error if Page is not present in response // do not throw error if Page is not present in response
[MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error]; [MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error];
} else { } else {
@ -666,6 +668,7 @@
if (pageType) { if (pageType) {
[[MVMCoreCache sharedCache] addPageToCache:obj pageType:pageType queue:nil waitUntilFinished:YES completionBlock:NULL]; [[MVMCoreCache sharedCache] addPageToCache:obj pageType:pageType queue:nil waitUntilFinished:YES completionBlock:NULL];
} else { } else {
MVMCoreLog(@"Cache no page Error: ");
errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoPageType domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]; errorObject = [[MVMCoreErrorObject alloc] initWithTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeNoPageType domain:ErrorDomainNative location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]];
} }
} else { } else {