Mailing List webobjects-dev@wocommunity.org Message #108
From: Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] Uncatchable Exception somewhere in DirectAction/D2W
Date: Tue, 23 Mar 2021 11:12:17 +0100
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Signed Data (Text SHA256)
Thanks, that helped. Don’t ask why I did not think of looking into the sources myself (blush)

By overriding the reportException() in my DirectAction class I can now trap the exception. 

/**
 * Let our application handle the error reporting. 
 * 
 * @param ex the exception thrown
 */
@Override
public WOActionResults reportException(Exception ex) {
    Application application = (Application)Application.application();
    WOContext context = context();    
    return application.handleException(ex, context);    
}



On 3 Mar 2021, at 20:02, Hugi Thordarson <webobjects-dev@wocommunity.org> wrote:

Hi Markus,
ERD2WDirectAction seems to be doing some really funky stuff to catch and handle exceptions in performActionNamed().
If there's no D2W involved you might want to consider inheriting from ERXDirectAction instead.


- hugi



On 3 Mar 2021, at 14:41, Markus Ruggiero (rucotec) <webobjects-dev@wocommunity.org> wrote:

I have a direct action that crashes and I cannot catch the exception. Why?

Scenario:

/**
 * dummy to demonstrate the issue
 */
public class DirectAction extends ERD2WDirectAction {

    public WOActionResults crashAction() throws Exception {
     throw new Exception("Crash in DirectAction");
    }
}

Where can I catch this Exception? It does not trigger anything in Application (which extends ERXApplication)
Both handle...() methods do not respond.

@Override
public WOResponse handleActionRequestError(WORequest aRequest, Exception exception, String reason,
WORequestHandler aHandler, String actionClassName, String actionName, Class actionClass,
WOAction actionInstance) {
// TODO Auto-generated method stub
return super.handleActionRequestError(aRequest, exception, reason, aHandler, actionClassName, actionName, actionClass,
actionInstance);
}

@Override
public WOResponse handleException(Exception anException, WOContext aContext)
{
super.handleException(anException, aContext);
        .......

The result of the crash is er.directtoweb.pages.templates.ERD2WMessagePageTemplate being rendered with my PageWrapper.

As there is (I assume) not much D2W involved here how do I trap this error and handle it my way? What am I missing?

Thanks for any idea
---markus---


Markus Ruggiero

rucotec GmbH                        web https://rucotec.ch
Steinenvorstadt 79                email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701











Markus Ruggiero


rucotec GmbH                        web https://rucotec.ch
Steinenvorstadt 79                email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701








Content Unaltered as verified By:
<markus.ruggiero@rucotec.ch>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster