[MAGNOLIA-4339] rendering: improve exception handling Created: 26/Jan/12  Updated: 30/May/23  Resolved: 19/Mar/12

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

Type: New Feature Priority: Major
Reporter: Daniel Lipp Assignee: Daniel Lipp
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
is causing MAGNOLIA-4134 Method inPublicMode() in ModeDependen... Closed
relation
is related to MAGNOLIA-8924 Freemarker doesn't show exception Open
is related to MAGNOLIA-4122 rendering: ExceptionHandling should n... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

We should have the exception handler (similar to the freemarker one) on the rendering context to make this behaviour global (JSP and other languages).



 Comments   
Comment by Daniel Lipp [ 30/Jan/12 ]

Description of Freemarker's ExceptionHandling: http://freemarker.sourceforge.net/docs/pgui_config_errorhandling.html

Comment by Tobias Mattsson [ 19/Mar/12 ]

The method inPublicMode() in ModeDependentRenderExceptionHandler is never called and ModeDependentTemplateExceptionHandler should not be deprecated because it's a key part of how the mechanism works.

When a freemarker template fails this is what happens:

  • Freemarker logs the exception always
  • It will then call the TemplateExceptionHandler to let it decide what to do
  • We use ModeDependentTemplateExceptionHandler which does different things depending on whether the instance is an admin or a public
    • For a public: it does nothing
    • For an author: it writes the exception to the output stream and then throws a TemplateException
  • A thrown exception gets passed to ModeDependentRenderExceptionHandler which again tests if the instance is an author or a public
    • For a public it will log the exception, but this code is never reached, see above
    • For an author it will log the exception a second time and write the exception to the output stream again (without the trace and with more details)

Note, that the error mechanism is the same for all freemarker rendering, not just the cms rendering. The user interface also uses the freemarker support, for instance the module manager ui and many gui controls, as well as the rendering of templates for email.

Comment by Tobias Mattsson [ 19/Mar/12 ]

New tasks following review tracked in MAGNOLIA-4134

Generated at Mon Feb 12 03:54:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.