ExecutionCleanup bury unhandled exceptions

asked 2015-04-03 22:34:19 +0800

tykiim gravatar image tykiim
5 1

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?

delete flag offensive retag edit


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

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-08 10:31:00 +0800

cor3000 gravatar image cor3000
4952 2 7
ZK Team

updated 2015-04-08 10:31:17 +0800

Hi Tykiim,

The listener works as you describe for initial page loads: e.g. when the exception is thrown during page initialization

        throw new NullPointerException("BANG");

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

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2015-04-03 22:34:19 +0800

Seen: 33 times

Last updated: Apr 08 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More