You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jchappelle <jc...@4redi.com> on 2014/03/14 00:16:44 UTC

Pass exception to internal error page

I am using wicket 6.14.0.

I have a RequestCycleListener that listens for onException. I handle
PageExpiredException, UnauthorizedInstantiationException(this is custom),
and by default I redirect to a custom ErrorPage class that takes the
Exception object in the constructor. It also contains a list of ignored
exceptions that it will return null for. This custom ErrorPage actually
reports an error to our JIRA bug tracker when it renders to the user.

The problem I am having is we are getting a lot of bug reports for things
like StalePageException and ComponentNotFoundException when I think wicket
can handle those without the user knowing. While I can add them to the
ignored list, I don't think this is a good design because as wicket changes,
these exceptions can change.

I would like a way to just register my internal error page with
getApplicationSettings().setInternalErrorPage(...) but I can't because I
won't have my Exception passed to my error page. Is there a way to do this?
Or is there some way to access the last exception associated with the
session?

I suppose I can create an Exception variable in my Session class and set it
in my RequestCycleListener but I'm hoping there is a better way.

Thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Pass-exception-to-internal-error-page-tp4664951.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Pass exception to internal error page

Posted by Martin Grigorov <mg...@apache.org>.
Hi,


On Fri, Mar 14, 2014 at 4:11 PM, jchappelle <jc...@4redi.com> wrote:

> Hi Martin,
>
> Thanks for the quick reply.
>
> We don't currently detect duplicate issues automatically. We do get several
> duplicates from users because they tend to click the same bad button over
> and over. I'm not too worried about attackers because you have to log in to
> get anywhere in our application. The way I have thought about doing it is
> having a sourceId in our ErrorReport class that would identify the report.
> The sourceId might be the page and breadcrumb trail or something of that
> nature. Then the ErrorReportingService would keep maybe keep a hash of the
> sourceId or store the sourceId's in the database and make sure others with
> that id are not sent for a certain time window. Although that is not
> perfect, because it could prevent errors from getting to us that need to.
>
> Can I make a new feature issue in JIRA for the DefaultExceptionMapper to
> pass the exception to the constructor of the internal error page? Maybe it
> could be a new type of UnexpectedExceptionDisplay in IExceptionSettings
> called SHOW_INTERNAL_ERROR_PAGE_WITH_EXCEPTION. That way it doesn't risk
> breaking existing users' internal error pages.
>

With a patch would be awesome!


>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Pass-exception-to-internal-error-page-tp4664951p4664973.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Pass exception to internal error page

Posted by jchappelle <jc...@4redi.com>.
Hi Martin,

Thanks for the quick reply.

We don't currently detect duplicate issues automatically. We do get several
duplicates from users because they tend to click the same bad button over
and over. I'm not too worried about attackers because you have to log in to
get anywhere in our application. The way I have thought about doing it is
having a sourceId in our ErrorReport class that would identify the report.
The sourceId might be the page and breadcrumb trail or something of that
nature. Then the ErrorReportingService would keep maybe keep a hash of the
sourceId or store the sourceId's in the database and make sure others with
that id are not sent for a certain time window. Although that is not
perfect, because it could prevent errors from getting to us that need to.

Can I make a new feature issue in JIRA for the DefaultExceptionMapper to
pass the exception to the constructor of the internal error page? Maybe it
could be a new type of UnexpectedExceptionDisplay in IExceptionSettings
called SHOW_INTERNAL_ERROR_PAGE_WITH_EXCEPTION. That way it doesn't risk
breaking existing users' internal error pages.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Pass-exception-to-internal-error-page-tp4664951p4664973.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Pass exception to internal error page

Posted by Martin Grigorov <mg...@apache.org>.
Hi,



On Fri, Mar 14, 2014 at 1:16 AM, jchappelle <jc...@4redi.com> wrote:

> I am using wicket 6.14.0.
>
> I have a RequestCycleListener that listens for onException. I handle
> PageExpiredException, UnauthorizedInstantiationException(this is custom),
> and by default I redirect to a custom ErrorPage class that takes the
> Exception object in the constructor. It also contains a list of ignored
> exceptions that it will return null for. This custom ErrorPage actually
> reports an error to our JIRA bug tracker when it renders to the user.
>
> The problem I am having is we are getting a lot of bug reports for things
> like StalePageException and ComponentNotFoundException when I think wicket
>

Indeed Wicket handles StalePageException.
ComponentNotFoundException usually means that there is an error in the
application, so I think it is good to handle it as you do now.


> can handle those without the user knowing. While I can add them to the
> ignored list, I don't think this is a good design because as wicket
> changes,
> these exceptions can change.
>
> I would like a way to just register my internal error page with
> getApplicationSettings().setInternalErrorPage(...) but I can't because I
> won't have my Exception passed to my error page. Is there a way to do this?
> Or is there some way to access the last exception associated with the
> session?
>
> I suppose I can create an Exception variable in my Session class and set it
> in my RequestCycleListener but I'm hoping there is a better way.
>

storing it in the session is the best place.
other places to store it are RequestCycle's metadata or a ThreadLocal but
usually Wicket will make a http redirect to load the configured internal
error page and those won't be valid any more.

How do you check whether a given type of error is logged in Jira just once ?
An attacker can create thousands of tickets in Jira by just reloading a
page that leads to a problem.


>
> Thanks!
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Pass-exception-to-internal-error-page-tp4664951.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>