Discussion:
How to handle "Service Unavailable" errors in ajax requests
mscoon
2018-06-11 12:10:51 UTC
Permalink
Hi all,

I have an AjaxSubmitLink which fails silently if the back-end server goes
away.

In debug mode, the ajax debug console shows:

ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Service
Unavailable

This is in Wicket 6.x

Is there a way to catch these kinds of errors and show a message to the
user or *try* to redirect to an error page (which will naturally lead to an
HTTP error)?

Thanks
Marios
Martin Grigorov
2018-06-11 12:49:46 UTC
Permalink
Hi,

Have you tried with AjaxCallListener's failure handler ?
If jQuery.ajax() notifies its error listeners then it should work.

The redirect will work only if the error page is served by something that
is still up, because "Service Unavailable" means that the web server (e.g.
Tomcat) is down.
Post by mscoon
Hi all,
I have an AjaxSubmitLink which fails silently if the back-end server goes
away.
ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Service
Unavailable
This is in Wicket 6.x
Is there a way to catch these kinds of errors and show a message to the
user or *try* to redirect to an error page (which will naturally lead to an
HTTP error)?
Thanks
Marios
mscoon
2018-06-16 04:41:39 UTC
Permalink
The ajax failure handler did indeed do the trick.

Thanks, Martin.
Post by Martin Grigorov
Hi,
Have you tried with AjaxCallListener's failure handler ?
If jQuery.ajax() notifies its error listeners then it should work.
The redirect will work only if the error page is served by something that
is still up, because "Service Unavailable" means that the web server (e.g.
Tomcat) is down.
Post by mscoon
Hi all,
I have an AjaxSubmitLink which fails silently if the back-end server goes
away.
ERROR: Wicket.Ajax.Call.failure: Error while parsing response: Service
Unavailable
This is in Wicket 6.x
Is there a way to catch these kinds of errors and show a message to the
user or *try* to redirect to an error page (which will naturally lead to
an
Post by mscoon
HTTP error)?
Thanks
Marios
Loading...