You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wayne W <wa...@gmail.com> on 2014/09/26 13:25:33 UTC

Error page for AJAX requests

Hi all,

we've recently moved to Wicket 6.17 from 1.4 and I'm having trouble with
NOT showing the default wicket error page when a runtime exception is
thrown from an AjaxLink.

I've set the following in the application:

getApplicationSettings().setInternalErrorPage(ErrorPage.class);

getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.
SHOW_INTERNAL_ERROR_PAGE);


but it does't seem to have any effect. We override
AbstractRequestCycleListener and specifically IRequestHandler
onException(RequestCycle cycle, Exception e) to perform different error
pages depending on the nature of the exception (for example entitynotfound
exception). We check here to see if its an ajax request like this:


if(cycle.getRequest() instanceof WebRequest && ((WebRequest)
cycle.getRequest()).isAjax()) {

return null; // let wicket take care of it.

}


Is there anyway for ajax requests I can do something like this (which is
what we return for non-ajax requests):


return new RenderPageRequestHandler(new PageProvider(new ErrorPage(page,
e)));


many thanks

Re: Error page for AJAX requests

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Check org.apache.wicket.settings.ExceptionSettings#setAjaxErrorHandlingStrategy

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Sep 26, 2014 at 1:25 PM, Wayne W <wa...@gmail.com>
wrote:

> Hi all,
>
> we've recently moved to Wicket 6.17 from 1.4 and I'm having trouble with
> NOT showing the default wicket error page when a runtime exception is
> thrown from an AjaxLink.
>
> I've set the following in the application:
>
> getApplicationSettings().setInternalErrorPage(ErrorPage.class);
>
> getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.
> SHOW_INTERNAL_ERROR_PAGE);
>
>
> but it does't seem to have any effect. We override
> AbstractRequestCycleListener and specifically IRequestHandler
> onException(RequestCycle cycle, Exception e) to perform different error
> pages depending on the nature of the exception (for example entitynotfound
> exception). We check here to see if its an ajax request like this:
>
>
> if(cycle.getRequest() instanceof WebRequest && ((WebRequest)
> cycle.getRequest()).isAjax()) {
>
> return null; // let wicket take care of it.
>
> }
>
>
> Is there anyway for ajax requests I can do something like this (which is
> what we return for non-ajax requests):
>
>
> return new RenderPageRequestHandler(new PageProvider(new ErrorPage(page,
> e)));
>
>
> many thanks
>