Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Data model

...

Code Block
error_logging_exception_root_cause _detail (
  exception_root_cause _detail_id,  -- Primary key of the table
  exception_root_cause_id,          -- References the error_logging_exception_root_cause table above
  file_name,                        -- The filename extracted from the stack trace
  class_name,                       -- The class name extracted from the stack trace
  method_name,                      -- The method name extracted from the stack trace
  line_number                       -- The line number extracted from the stack trace
)

Error handling

In the OpenMRS core there are 2 pages where uncaught exceptions are handled, which are uncaughtException.jsp and errorHandler.jsp. When uncaught exception occurred one of those pages is displayed and Error Logging Module is notified by about it via extension points in those pages. To get exception and detail information about it is used an attribute of the request "javax.servlet.error.exception".

Error handling at the application level

Exceptions thrown by code going threw Servlets and Controllers are handled by uncaughtException.jsp because of the web.xml entry. 

Code Block
languagejava
titleweb.xml
...
<error-page>
        <exception-type>java.lang.Exception</exception-type>
        <location>/uncaughtException</location>
</error-page>

<servlet-mapping>
        <servlet-name>openmrs</servlet-name>
        <url-pattern>/uncaughtException</url-pattern>
</servlet-mapping>
...

...

Error handling at the page level

Exceptions  thrown from the .tag files and jsps including embedded scriptlets are handled by errorHandler.jsp which is defined as the default error page via a jsp directive.

Code Block
languagejava
titleerrorHandler.jsp
<%@ page isErrorPage="true" import="java.io.*" %>
...

...