You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lutz Hühnken <lh...@googlemail.com> on 2009/03/05 14:13:55 UTC

Re: http error on exception

The way I like to do it: decorate the exception handler in your AppModule.java



    /**
     * Decorate the exception handler in a way that it will just return error
     * code 500 in production mode. See
     * http://tapestry.apache.org/tapestry5/cookbook/exceptions.html On the
     * bottom of the page, "Version 3".
     */
    public RequestExceptionHandler
decorateRequestExceptionHandler(final Logger logger, final Response
response,
            @Symbol(SymbolConstants.PRODUCTION_MODE) final boolean
productionMode, final Object service) {
        if (!productionMode) {
            return null;
        }
        return new RequestExceptionHandler() {
            public void handleRequestException(final Throwable
exception) throws IOException {
                logger.error(exception.getMessage(), exception);

response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Internal Server Error");
            }
        };
    }


Hth,

Lutz


On Mon, Feb 23, 2009 at 6:17 PM, Thomas Clavier <cl...@argia.fr> wrote:
>    Hello All,
>
> I search a solution to launch an http error (500) when tapestry throw an
> Exception. I have found documentation on how to override tapestry
> Exception ... but that launch a "200 OK"
>
> have you a solution ?
>
> --
> Thomas Clavier                 http://www.tcweb.org
> Argia Engineering              JabberID : clavier@argia.fr
> +33 (0)6 20 81 81 30           +33 (0)950 783 783
>
>
>



-- 
altocon GmbH
http://www.altocon.de/
Software Development, Consulting
Hamburg, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org