Pretty error page that helps you debug your web application.
NOTE: This module is base on whoops and uses the same front end resources.
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-whoops</artifactId>
<version>1.5.0</version>
</dependency>{
use(new Whoops());
get("/", req -> {
throw new IllegalStateException("Something broken!");
});
}The pretty error page handler is available in development mode: application.env = dev
The pretty error page is implemented via err(req, rsp, err). You might run into troubles if your application require custom error pages. On those cases you probably won't use this module or apply one of the following options:
This option is useful if you have custom error pages on some specific exceptions:
{
err(NotFoundException.class, (req, rsp, err) -> {
// custom not found
});
err(AccessDeniedException.class, (req, rsp, err) -> {
// custom access denied
});
// not handled it use whoops
use(new Whoops());
}Here the custom error page for NotFoundException or AccessDeniedException will be render before the Whoops error handler.
This options will active Whoops in dev and the custom err pages in prod-like environments:
{
on("dev", () -> {
use(new Whoops());
})
.orElse(() -> {
err((req, rsp, err) -> {
// custom not found
});
});
}