Search in sources :

Example 1 with InvalidPathEncodingException

use of ratpack.path.InvalidPathEncodingException in project ratpack by ratpack.

the class DefaultContext method error.

public void error(Throwable throwable) {
    if (throwable instanceof ClientErrorException) {
        clientError(((ClientErrorException) throwable).getClientErrorCode());
        return;
    }
    ServerErrorHandler serverErrorHandler = get(ServerErrorHandler.TYPE);
    throwable = unpackThrowable(throwable);
    ThrowableHolder throwableHolder = getRequest().maybeGet(ThrowableHolder.TYPE).orElse(null);
    if (throwableHolder == null) {
        getRequest().add(ThrowableHolder.TYPE, new ThrowableHolder(throwable));
        try {
            if (throwable instanceof InvalidPathEncodingException) {
                serverErrorHandler.error(this, (InvalidPathEncodingException) throwable);
            } else {
                serverErrorHandler.error(this, throwable);
            }
        } catch (Throwable errorHandlerThrowable) {
            onErrorHandlerError(serverErrorHandler, throwable, errorHandlerThrowable);
        }
    } else {
        onErrorHandlerError(serverErrorHandler, throwableHolder.getThrowable(), throwable);
    }
}
Also used : ServerErrorHandler(ratpack.error.ServerErrorHandler) InvalidPathEncodingException(ratpack.path.InvalidPathEncodingException)

Aggregations

ServerErrorHandler (ratpack.error.ServerErrorHandler)1 InvalidPathEncodingException (ratpack.path.InvalidPathEncodingException)1