[MAGNOLIA-7179] Make configurable page-level rendering exceptions behaviour Created: 16/Oct/17  Updated: 16/Jun/21  Resolved: 16/Jun/21

Status: Closed
Project: Magnolia
Component/s: rendering
Affects Version/s: 5.5.6
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Mercedes Iruela Assignee: Unassigned
Resolution: Won't Do Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Rendering errors in Magnolia are handled by info.magnolia.rendering.engine.ModeDependentRenderExceptionHandler and the behaviour by default is :

Exception handler providing different output based on the configuration of the current instance. Full stacktrace gets rendered on the author instance only, while ignoring the stacktraces in preview mode and on public instances.

OOTB Magnolia returns code 200 on public instances and preview when an error comes up when rendering. This is the default behaviour of Magnolia in other not to show any errors on the website to customers.

In case of errors at page-level, it results in a blank page. The idea of this ticket is change this behaviour at page-level, returning error code 500 in such cases or allowing it to be more easily configurable.

NOTE: Nowadays, this behaviour can be modified by implementing custom RenderExceptionHandler that will implement interface info.magnolia.rendering.engine.RenderExceptionHandler.



 Comments   
Comment by Torsten Landmann [ 20/Oct/17 ]

Hi everyone,

may I suggest that when you make this configurable as planned, there is at least one option where Magnolia interferes with the exception and error handling of the servlet container as little as possible. This would mean in particular:

  • If an uncaught exception is enountered and Magnolia chooses to catch it for any reason (e.g. to log it), it should re-throw it afterwards so it reaches the servlet container (e.g. Tomcat).
  • If an "HttpServletResponse#sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)" call has been made, this should reach the servlet container (e.g. Tomcat).
  • If an "HttpServletResponse#setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)" call has been made, this should reach the servlet container (e.g. Tomcat).

Bottom line is that with error handling the only bullet-proof bet is the servlet container itself. Magnolia will never be able to fully replace this because it's client code itself.
Every development team that shares this point of view should have the opportunity to fully rely on the servlet container for doing the error handling.
For that purpose Magnolia should offer an option where it totally lets the servlet container do the error handling and doesn't interfere with it.

Thank you, best regards,
Torsten

Comment by Jan Haderka [ 16/Jun/21 ]

This behaviour can be achieved by implementing custom RenderExceptionHandler that will implement interface info.magnolia.rendering.engine.RenderExceptionHandler.

Generated at Mon Feb 12 04:21:27 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.