Different applications have different requirements. Take a look at the exception handling in the workeffort application download http://www.logicden.com to get an idea.
The files you may want to look at are: ApplicationExceptionHandler.java, files in package com.logicden.workeffort.service.exception, struts-config.xml, sql-error-codes.xml. Note that the application uses Spring and the SQL exceptions get translated to custom exceptions using the mappings in sql-error-codes.xml. This allows me to support multiple databases and keep with the layers of the application agnostic of the target database. The actions generally don't have any try/catch blocks. I let struts handle the exceptions. ----- Original Message ----- From: "Brian McGovern" To: user@struts.apache.org Subject: Proper n tiered exception handling Date: Tue, 15 Feb 2005 10:28:27 -0500 > > I'm looking to get a handle on best exception handling practices in > my app. Kinda beginner question i guess, sorry. > > Im catching the various sql and naming exceptions in the data > classes and logging and throwing a custom exception called > ApplicationException which is blank and provided below. I've read > up but an still a little confused on how exactly to build this > exception class to extend the available struts exception classes > that would gracefully map to an error display jsp where i could > display the error to the user. Right now I just get the HTTP > status 500 strack trace on the screen. > > Controller snippet that catches the data obj's thrown ApplicationException: > ------------------------------------------------------------------------ > try { > zRepBeanBn = > MyData.getRepByID(StringUtils.convertToInt(request.getParameter("RepID"))); > }catch (ApplicationException zAppEx){ > throw zAppEx; > } > ------------------------------------------------------------------------ > > ApplicationException that needs work: How do I extend this? > ------------------------------------------------------------------------ > public class ApplicationException extends Exception { > public ApplicationException(String message) { } > } > ------------------------------------------------------------------------ > > Thanks http://www.logicden.com -- _______________________________________________ Find what you are looking for with the Lycos Yellow Pages http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]