Class DefaultErrorFormatter

java.lang.Object
com.groiss.gui.DefaultErrorFormatter
All Implemented Interfaces:
ErrorFormatter

public class DefaultErrorFormatter extends Object implements ErrorFormatter
This class is responsible for showing the error page.
  • Constructor Details

    • DefaultErrorFormatter

      public DefaultErrorFormatter()
  • Method Details

    • format

      public Page format(Throwable e)
      Default implementation of showing an error page.
      Specified by:
      format in interface ErrorFormatter
      Returns:
      the page, for example an HTMLPage object.
    • getDetails

      public String getDetails(Throwable e)
      Returns the thread name, timestamp and stack-trace of the exception. The result is the empty string if the exception is a top level exception without an inner exception or the user is not allowed to see the details (canShowDetails()).
    • canShowDetails

      public boolean canShowDetails()
      Returns true if the system is not yet set up or the user has admin rights.
    • formatJSON

      public JSONObject formatJSON(Throwable e)
      Default implementation for returning a JSONObject representation of the error. The object contains the following properties:
      • errornumber (only for ApplicationExceptions),
      • message: the message text,
      • title: the string "error " plus errornumber,
      • error: title + message
      • showHTML: if the error message can contain html text (true if exception sets setAllowHTMLMessage(true) or global parameter ep.exception.allowhtmlmessage is true).
      Note, that the client code relies on this structure, the properties "message", "title", and "error" are mandatory.
      Specified by:
      formatJSON in interface ErrorFormatter
      Returns:
      a json object