{title:'Java Method Throwable Types', updated:'9.0.0'}

Annotated Java methods can throw any of the following:

All other throwables get processed as follows:

Example:

| @RestGet("/user/login") | public Ok login( | @FormData("username") String username, | @FormData("password") String password | ) throws Unauthorized | { | if (! isOK(username, password)) | throw new Unauthorized("You're not welcome!"); | | return Ok.OK; | }