-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I'm looking into burying unhandled exceptions by logging them and not showing anything in the UI. Apparently I'm supposed to be able to use ExecutionCleanup to do this, by clearing the list of exceptions in cleanup(). I have tried this, but the exceptions are still pushed to the client and I get the error.
The documentation (zkoss.org/javadoc/7.0.5/zk/org/zkoss/zk/ui/util/ExecutionCleanup.html#cleanup(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution, java.util.List) says
errs - a list of exceptions (java.lang.Throwable) if any exception occurred before this method is called, or null if no exception at all. Note: you can manipulate the list directly to add or clean up exceptions. For example, if exceptions are fixed correctly, you can call errs.clear() such that no error message will be displayed at the client.
Here's a simple fiddle showing the problem:zkfiddle.org/sample/306k1k9/1-ExecutionCleanup-failure
Note that I have also tried listening for java.lang.Throwable
in zk.xml
, and that does work, but I want to be able to look at the list on the server-side first, if possible.
Is this a known bug or am I doing it wrong or something else?
Hi Tykiim,
The listener works as you describe for initial page loads: e.g. when the exception is thrown during page initialization
<zk>
<zscript>
throw new NullPointerException("BANG");
</zscript>
</zk>
or in a doAfterCompose
In that case the removed exception is hidden from the servlet output stream.
In the ajax case (clicking a button causing an exception) the exception will never be directly written to the servlet output stream, and the alert popup with just the error message is displayed. The execution cleanup is called later, after the Ajax error handling, and hence cannot remove the exception as you expect.
If you want to customize the behavior you have to implement your own Ajax error handling as described here. Since you already seem to have found that documentation I can assure you that all the error handling is happening at the server side, before any information is written to the client browser. With the Ajax response.
Regards Robert
Asked: 2015-04-03 22:34:19 +0800
Seen: 33 times
Last updated: Apr 08 '15
How to stop combining commands in an ajax call ?
zk.auSend not called on composer
Font Awesome Problem with IE8 when security option "font download" is disabled
Send a client event with JSON data
How to capture the Browser Window Resize/Size Event
Toggled Popup - Close ONLY on toggling, not on focus lost
Verify existence -Verificar existencia DNI
I'll look into the issue, I assume you are also using ZK 7.0.5?
cor3000 ( 2015-04-08 09:26:06 +0800 )edit