You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerry Jalenak <Je...@LABONE.com> on 2003/08/08 17:19:32 UTC
[OT - Slightly] Returning Error Status from Business Layer
Just curious - how do most of you return errors from your business model?
Do you simply return an integer value (-1, 0. 99?) and then interpret it in
the action? Or do you return a error string that maps to something in
ApplicationResources? Any other techniques? I'm trying to find a 'best
practice' on how to do this....
Thanks -
Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS 66219
(913) 577-1496
jerry.jalenak@labone.com
This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: securityincidentreporting@labone.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: [OT - Slightly] Returning Error Status from Business Layer
Posted by Mike Jasnowski <mj...@bea.com>.
You should look also at the declarative exception handling Struts has.
-----Original Message-----
From: David Graham [mailto:grahamdavid1980@yahoo.com]
Sent: Friday, August 08, 2003 3:26 PM
To: Struts Users Mailing List
Subject: Re: [OT - Slightly] Returning Error Status from Business Layer
--- Erik Price <ep...@ptc.com> wrote:
>
>
> Jerry Jalenak wrote:
>
> > Just curious - how do most of you return errors from your business
> model?
> > Do you simply return an integer value (-1, 0. 99?) and then interpret
> it in
> > the action?
Yuck.
> >Or do you return a error string that maps to something in
> > ApplicationResources? Any other techniques? I'm trying to find a
> 'best
> > practice' on how to do this....
>
> Java has a really elegant mechanism for returning errors called
> Exceptions....
Errors from the business layer should be reported as exceptions. The
exception could carry a list of error messages or resource keys so that
the next layer can display a message to the user. Or the next layer could
interpret the exception into some error message, it's your choice.
David
>
>
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: [OT - Slightly] Returning Error Status from Business Layer
Posted by David Graham <gr...@yahoo.com>.
--- Erik Price <ep...@ptc.com> wrote:
>
>
> Jerry Jalenak wrote:
>
> > Just curious - how do most of you return errors from your business
> model?
> > Do you simply return an integer value (-1, 0. 99?) and then interpret
> it in
> > the action?
Yuck.
> >Or do you return a error string that maps to something in
> > ApplicationResources? Any other techniques? I'm trying to find a
> 'best
> > practice' on how to do this....
>
> Java has a really elegant mechanism for returning errors called
> Exceptions....
Errors from the business layer should be reported as exceptions. The
exception could carry a list of error messages or resource keys so that
the next layer can display a message to the user. Or the next layer could
interpret the exception into some error message, it's your choice.
David
>
>
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: [OT - Slightly] Returning Error Status from Business Layer
Posted by Erik Price <ep...@ptc.com>.
Jerry Jalenak wrote:
> Just curious - how do most of you return errors from your business model?
> Do you simply return an integer value (-1, 0. 99?) and then interpret it in
> the action? Or do you return a error string that maps to something in
> ApplicationResources? Any other techniques? I'm trying to find a 'best
> practice' on how to do this....
Java has a really elegant mechanism for returning errors called
Exceptions....
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org