Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error page handler prevents exception from being viewed in Edit mode #3365

Open
3 tasks
HitmanInWis opened this issue Jun 18, 2024 · 1 comment
Open
3 tasks

Comments

@HitmanInWis
Copy link
Contributor

Required Information

  • AEM Version, including Service Packs, Cumulative Fix Packs, etc: AEM Cloud Service
  • ACS AEM Commons Version: 6.0.0
  • Reproducible on Latest? yes

Expected Behavior

When in author EDIT mode, the ACS AEM Commons error handler is supposed to let the default AEM handler render internal server errors. See the following code from default.jsp:

    if (ModeUtil.isPreview(slingRequest)) {
        %><cq:include script="/apps/acs-commons/components/utilities/errorpagehandler/preview/errormessage.jsp" /><%
        return;
    } else {
        // In Author and Edit or Design, so allow OOTB WCMDebugFilter to handle the error message display
        return;
    }

Actual Behavior

Because there is a return; in the else statement, the default error handling from /libs/sling/servlet/errorhandler/default.jsp is never reached, resulting in the end user getting a blank page on exception in Edit/Design mode. Removing the return; restores the expected behavior, with the exception stack trace printing to the window.

Steps to Reproduce

Implement the ACS AEM Commons error handling feature per instructions at https://adobe-consulting-services.github.io/acs-aem-commons/features/error-handler/index.html and trigger a RuntimeException for a server request while in author EDIT mode.

@HitmanInWis
Copy link
Contributor Author

For those looking for a workaround, updating my default.jsp to the following code seems to resolve:

    Integer statusCode = (Integer) request.getAttribute(SlingConstants.ERROR_STATUS);
    if (statusCode == null) { statusCode = SlingHttpServletResponse.SC_INTERNAL_SERVER_ERROR; }
    WCMMode wcmMode = WCMMode.fromRequest(request);

    if (statusCode < SlingHttpServletResponse.SC_INTERNAL_SERVER_ERROR || wcmMode == WCMMode.DISABLED || wcmMode == WCMMode.PREVIEW) {
%><cq:include script="/apps/acs-commons/components/utilities/errorpagehandler/default.jsp" /><%
    } else {
%><cq:include script="/libs/sling/servlet/errorhandler/default.jsp" /><%
    }

Basically just capturing the case that the ACS Commons handler is doing the return that prevents use of the OOTB libs default.jsp and including it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants