You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mscoon <ms...@gmail.com> on 2018/06/11 12:10:51 UTC

How to handle "Service Unavailable" errors in ajax requests

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

Re: How to handle "Service Unavailable" errors in ajax requests

Posted by mscoon <ms...@gmail.com>.
The ajax failure handler did indeed do the trick.

Thanks, Martin.

On Mon, Jun 11, 2018 at 3:49 PM, Martin Grigorov <mg...@apache.org>
wrote:

> 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.
>
> On Mon, Jun 11, 2018 at 3:10 PM, mscoon <ms...@gmail.com> wrote:
>
> > 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
> >
>

Re: How to handle "Service Unavailable" errors in ajax requests

Posted by Martin Grigorov <mg...@apache.org>.
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.

On Mon, Jun 11, 2018 at 3:10 PM, mscoon <ms...@gmail.com> wrote:

> 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
>