You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by raulmt <ra...@gmail.com> on 2011/03/04 18:14:56 UTC

Centralize error handling

We want to handle exceptions in a centralized way, so in a Page or Component
we just throw an exception and "someone" handles that exception and shows
the error message accordingly. For this, we override RequestExceptionHandler
to show custom error messages depending on the type of error.

The problem we have is that the Registry logs with ERROR level all of the
exceptions thrown in any Page or Component method, so even when we throw
these exceptions to let the RequestExceptionHandler handle them, our log
file is full of ERROR logs of exceptions that we already handle. One
solution could be to mute the logs from Tapestry IOC Registry, but i'm
afraid we could miss other logs that are important. Is there a way to "mute"
logs of exceptions already handled? Is this approach we took all wrong?

Thanks.

--
View this message in context: http://tapestry-users.832.n2.nabble.com/Centralize-error-handling-tp6089256p6089256.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Centralize error handling

Posted by raulmt <ra...@gmail.com>.
But, for example, access control errors are very common across the
application, so having a common place to handle them appears to be
reasonable. Is there another way to centralize aspects like commons error
handlings (access control, objects not found, requests without the expected
context parameters, etc…) without throwing exceptions in page or component
methods?

--
View this message in context: http://tapestry-users.832.n2.nabble.com/Centralize-error-handling-tp6089256p6089466.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Centralize error handling

Posted by LLTYK <LL...@mailinator.com>.
My approach would be not to throw exceptions all the time. The exception
handler is only used for fatal stuff, I don't throw stuff there by design.

--
View this message in context: http://tapestry-users.832.n2.nabble.com/Centralize-error-handling-tp6089256p6089399.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Centralize error handling

Posted by Josh Canfield <jo...@gmail.com>.
> We want to handle exceptions in a centralized way

My first approach would be to see how Tapestry already does it. In
TapestryModule there is a RequestFilter configured:

        configuration.addInstance("ErrorFilter", RequestErrorFilter.class);

One approach would be to add your own filter to catch your apps
exceptions so you can choose which go to the standard error page and
which go to your other error page.

The RequestErrorFilter uses services to do it's job so you could
alternatively provide your own implementation.

Josh

On Fri, Mar 4, 2011 at 9:14 AM, raulmt <ra...@gmail.com> wrote:
> We want to handle exceptions in a centralized way, so in a Page or Component
> we just throw an exception and "someone" handles that exception and shows
> the error message accordingly. For this, we override RequestExceptionHandler
> to show custom error messages depending on the type of error.
>
> The problem we have is that the Registry logs with ERROR level all of the
> exceptions thrown in any Page or Component method, so even when we throw
> these exceptions to let the RequestExceptionHandler handle them, our log
> file is full of ERROR logs of exceptions that we already handle. One
> solution could be to mute the logs from Tapestry IOC Registry, but i'm
> afraid we could miss other logs that are important. Is there a way to "mute"
> logs of exceptions already handled? Is this approach we took all wrong?
>
> Thanks.
>
> --
> View this message in context: http://tapestry-users.832.n2.nabble.com/Centralize-error-handling-tp6089256p6089256.html
> Sent from the Tapestry Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org