struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Getting at exceptions in Action Classes whenforwardedfromweb.xml?
Date Mon, 03 Oct 2005 23:34:06 GMT
Oh I see, sorry.

That would be a tomcat thing. I have a suspicion that there may never be 
an exception. Tomcat (or your appserver) is just creating an error - 
that doesn't mean that it actually threw a Java exception.

I believe that it is merely a status for the http response packet. The 
text that appears in the browser is purely browser-dependent.

So basically a real live java exception would tell you no more than you 
already know, except perhaps if there is one, a stacktrace from the guts 
of your appserver.

Preston CRAWFORD on 03/10/05 23:57, wrote:
> Right, but even at this point, if I did this, how do I get at the
> Exception within the action? The actual exception thrown that lead to a
> 500 error? That's what I'm trying to figure out. Regardless of how I get
> there.
> 
> Preston
> 
> 
> 
>>>>ahardy.struts@cyberspaceroad.com 10/3/2005 3:55:12 PM >>>
> 
> Yes you could do that, or you could try
> 
>       <error-page>
>           <error-code>404</error-code>
>           <location>/error404.do</location>
>       </error-page>
>       <error-page>
>           <error-code>500</error-code>
>           <location>/error500.do</location>
>       </error-page>
> 
> and map them to the same action class with a useful parameter for 
> mapping.getParameter() - perhaps slightly less coding.
> 
> 
> Preston CRAWFORD on 03/10/05 23:10, wrote:
> 
>>Even then, is there any way to get at the exception at self so it
> 
> gets
> 
>>printed? The problem is that when you setup web.xml to send it to an
>>action (I can't figure out a different way to do this that is fairly
>>simple) it's almost like the app server swallows it for the most
> 
> part
> 
>>and passes little information to the action. I can do things like
> 
> pass
> 
>>along the number of the error in the querystring...
>>
>>    <error-page>
>>        <error-code>404</error-code>
>>        <location>/error.do?exception=404</location>
>>    </error-page>
>>
>>But other than that I can't figure out how to get at the actual
>>exception so I can log that.
>>
>>Preston
>>
>>
>>
>>>>>ahardy.struts@cyberspaceroad.com 10/3/2005 2:33:16 PM >>>
>>
>>Preston CRAWFORD on 03/10/05 21:47, wrote:
>>
>>
>>>I'm trying to setup global exception handling. I have web.xml
>>
>>sending
>>
>>
>>>404 and 500 exceptions to /error.do. In that action I should be able
>>
>>to
>>
>>
>>>get at the exception, shouldn't I? Or do I have to do that earlier
>>
>>in
>>
>>
>>>the process? I simply want to get at the exception and log it.
>>>
>>
>>
>>I don't think you can. The response object is write-only, so there
> 
> is
> 
>>no 
>>way to tell.
>>
>>I might be grossly mistaken but I guess you would have to have
> 
> seperate
> 
>>error-pages for each type of exception. Haven't tried it myself but
>>will 
>>need to soon.
>>
>>Adam
>>
>>
> 
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
>>For additional commands, e-mail: user-help@struts.apache.org 
>>
>>
>>
> 
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
>>For additional commands, e-mail: user-help@struts.apache.org 
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org 
> For additional commands, e-mail: user-help@struts.apache.org 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message