Skip to content

Commit

Permalink
Merge pull request #942 from caelum/improving_exception_docs
Browse files Browse the repository at this point in the history
adding docs about exception attribute
  • Loading branch information
Turini committed Feb 20, 2015
2 parents d454efd + 58149da commit e0d1e54
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected boolean replay(Exception e) {

reportException(e);

logger.debug("handling exception {}", e.getClass());
logger.debug("handling exception {}", e.getClass(), e);
exresult.replay(result);

return true;
Expand Down
12 changes: 12 additions & 0 deletions vraptor-site/content/en/docs/controllers-rest.html
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,16 @@
}
~~~

Anytime you use `Result.on(...)` like that, the exception handler will intercept your exception and leave it accessible as a request attribute named `exception`. This means that in your 'form.jsp`, for instance, you can do something like:

~~~
#!jsp
<c:if test="${not empty exception}">
The following error occurred: ${exception.message}
</c:if>
~~~


## Monitoring the exceptions of your project

You can also use the [vraptor-error-control](http://www.vraptor.org/en/docs/plugins/#vraptor-error-control) plugin, that allows you to real time control error messages sending them by email.
12 changes: 12 additions & 0 deletions vraptor-site/content/pt/docs/controllers-rest.html
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,16 @@
}
~~~

Sempre que você utilizar o `Result.on(...)` dessa forma, o exception handler vai interceptar sua exceção e deixá-la acessível como um atributo da request, chamado `exception`. Isso significa que em seu `formulario.jsp`, por exemplo, você poderá fazer algo como:

~~~
#!jsp
<c:if test="${not empty exception}">
O seguinte erro ocorreu: ${exception.message}
</c:if>
~~~


## Monitorando as exceções do seu projeto

Se quiser, você também pode usar o plugin [vraptor-error-control](http://www.vraptor.org/pt/docs/plugins/#vraptor-error-control) para acompanhar as exceptions que acontecem em sua aplicação em tempo real. Ele te envia um e-mail com a mensagem de erro.

0 comments on commit e0d1e54

Please sign in to comment.