Pass exception to internal error page

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Pass exception to internal error page

jchappelle
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!
Reply | Threaded
Open this post in threaded view
|

Re: Pass exception to internal error page

Martin Grigorov-4
Hi,



On Fri, Mar 14, 2014 at 1:16 AM, jchappelle <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Pass exception to internal error page

jchappelle
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.
Reply | Threaded
Open this post in threaded view
|

Re: Pass exception to internal error page

Martin Grigorov-4
Hi,


On Fri, Mar 14, 2014 at 4:11 PM, jchappelle <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>