diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index d254be8..8b85d04 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -167,13 +167,12 @@ // Can continue loading with the page. [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]) || (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 + // handle no page error gracefully even if no pageType/page in response, but ResponseInfo has success // Something to show, or nothing was expected to show, can finish. [MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error]; } else { - MVMCoreLog(@"no page Error: "); - // Error, foreground request with no alert, action, or anything else to show. Abort with error. + + // Error, foreground request with no page, 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]]; [MVMCoreLoadRequestOperation loadAbortedWithError:error loadObject:loadObject]; } @@ -408,7 +407,6 @@ // Handle any module caching error and continue load. if (moduleCachingError) { - MVMCoreLog(@"possible point 1 for no page error"); [MVMCoreLoadRequestOperation handleError:moduleCachingError loadObject:loadObject showAlertForErrorIfApplicable:YES]; } @@ -424,7 +422,6 @@ // Handle any page caching error and continue load. if (pagesCachingError) { - MVMCoreLog(@"possible point 2 for no page error"); [MVMCoreLoadRequestOperation handleError:pagesCachingError loadObject:loadObject showAlertForErrorIfApplicable:YES]; } @@ -436,7 +433,6 @@ [MVMCoreLoadRequestOperation notifyListenersOfNewResponse:pages modules:modules systemParameters:systemParameters loadObject:loadObject]; } continueBlock:^{ if (error) { - MVMCoreLog(@"possible point 3 for no page error"); // Hold onto any error until we establish a delegate [MVMCoreLoadRequestOperation handleError:error loadObject:loadObject showAlertForErrorIfApplicable:NO]; loadObject.operation.alertToShow = YES; @@ -503,8 +499,10 @@ // 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) { - MVMCoreLog(@"handling no page Error gracefully2"); - // do not throw error if Page is not present in response + error.logError = YES; + error.errorScreenError = NO; + error.location = [NSString stringWithFormat:@"%li-%@",(long)ErrorCodeNoErrorPageSent,error.location]; + [MVMCoreLoadRequestOperation handleError:error loadObject:loadObject showAlertForErrorIfApplicable:YES]; [MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error]; } else { // No screen to load, finish the load. @@ -671,7 +669,6 @@ if (pageType) { [[MVMCoreCache sharedCache] addPageToCache:obj pageType:pageType queue:nil waitUntilFinished:YES completionBlock:NULL]; } 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]]; } } else { @@ -756,7 +753,7 @@ 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) { - MVMCoreLog(@"last point for no page error"); + // Show alert for error. [MVMCoreLoadRequestOperation createAndShowAlertForLoadObject:loadObject error:error delegateObject:loadObject.operation.delegateObject]; } @@ -776,11 +773,9 @@ // Native driven error screens still need to be loaded. (as long as the delegate desires) if (!loadObject.requestParameters.handleErrorsSilently && !error.silentError && error.errorScreenError && (![loadObject.delegateObject.loadDelegate respondsToSelector:@selector(shouldContinueToErrorPage:error:)] || [loadObject.delegateObject.loadDelegate shouldContinueToErrorPage:loadObject error:error])) { - MVMCoreLog(@"possible point 4 for no page error"); [MVMCoreLoadRequestOperation handleError:error loadObject:loadObject showAlertForErrorIfApplicable:YES]; [MVMCoreLoadRequestOperation handleLoadObject:loadObject error:error]; } else { - MVMCoreLog(@"possible point 5 for no page error"); [MVMCoreLoadRequestOperation handleError:error loadObject:loadObject showAlertForErrorIfApplicable:YES]; [MVMCoreLoadRequestOperation loadFinished:loadObject loadedViewController:nil errorObject:error]; }