public class Whoops extends Object implements Jooby.Module
Pretty error page that helps you debug your web application.
NOTE: This module is base on whoops and uses the same front end resources.
pretty error page
{
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 Router#err(Handler). You might run into troubles
if your application require custom error pages. On those cases you probably won't use this module
or if 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
});
});
}
| Constructor and Description |
|---|
Whoops()
Creates a new
Whoops module with max frame size of 8. |
Whoops(int maxFrameSize)
Creates a new
Whoops module. |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Env env,
com.typesafe.config.Config conf,
com.google.inject.Binder binder) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconfigpublic Whoops(int maxFrameSize)
Whoops module.maxFrameSize - Max number of frame to show in the pretty error page.public Whoops()
Whoops module with max frame size of 8.public void configure(Env env, com.typesafe.config.Config conf, com.google.inject.Binder binder)
configure in interface Jooby.ModuleCopyright © 2020. All rights reserved.