1

I am using the following code to show a common error page whenever an exception is thrown.

I have two questions. First question is how to configure it in a way to support all types of the exceptions? The other question is how to register the type of exception thrown in database for future maintenance? I know I can save them into database after catching them but how about exceptions such as antlr versioning exception that are not catch by back-end and will be thrown through front-end ?

   <global-results>
       <result name="cuerror">error.jsp</result>
   </global-results>

   <global-exception-mappings>
       <exception-mapping exception="java.lang.Exception" result="cuserror"/>
   </global-exception-mappings>
Roman C
  • 49,761
  • 33
  • 66
  • 176
Jack
  • 6,430
  • 27
  • 80
  • 151
  • What do you mean by *all types* of exceptions? – Aleksandr M Apr 02 '14 at 08:10
  • possible duplicate of [Which Exceptions to declare/handle in struts xml](http://stackoverflow.com/questions/20726425/which-exceptions-to-declare-handle-in-struts-xml) – Roman C Apr 02 '14 at 09:46

1 Answers1

0

If you want to catch all errors try java.lang.Throwable exception.

For database exception I suggest you declare new exceptions so catch database exceptions and throw you defined new exceptions, there you can decide the type of exception by new exception which is thrown

I do not see any reason for this, I think the database exception and its message is sufficient for maintenance.

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173