babgvant / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

With error filtering, need to be able to swallow the exception... #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
While you can do e.Dismiss() to stop it from being logged, the exception 
is still raised.   Would be nice if you could also set some flag where the 
exception is swallowed also?

Original issue reported on code.google.com by wayne.br...@gmail.com on 23 Jun 2007 at 12:08

GoogleCodeExporter commented 9 years ago
This can already be done via HttpContext.ClearError so it would unnecessarily 
end up 
duplicating the same functionality in ELMAH. Also filtering errors for logging 
is 
fundamentally different than suppressing them altogether. The best place to 
make the 
latter decision is at the actual site of the code that can be the subject of 
certain 
set of expected run-time errors. The error filtering feature was primarily 
added 
because many people running large web sites found that the log could quickly 
fill up 
with noise from errors that were actually to be expected and safe to ignore 
(the 
most frequently quoted examples were 404s and HttpRequestValidation).

Original comment by azizatif on 25 Jun 2007 at 8:28

GoogleCodeExporter commented 9 years ago
Then you cannot do this if you use the configuration version of the exception 
filtering.   Since the configuration has no way to swallow an exception, you 
must 
use the 'code' solution for exception filtering.

It would be very easy to add a configuration option to do this so that we could 
use 
just configuration without putting in code to install the error handler.

Original comment by wayne.br...@gmail.com on 27 Jun 2007 at 3:00

GoogleCodeExporter commented 9 years ago
I would suggest separating filtering errors from suppressing them. The latter, 
if 
needed in a global and configurable way, should be implemented as a separate 
module 
because it may be based on a different set of conditions entirely. You could 
then 
leverage all the same assertions infrastructure from ELMAH in that module. 
Could you 
give a concrete example of the conditions you use to swallow/suppress 
exceptions in 
your web application today?

Original comment by azizatif on 27 Jun 2007 at 4:50

GoogleCodeExporter commented 9 years ago
Googlebot causes exceptions in asp2.0 applications when it accesses 
webresource.axd 
(or when cached images of site are displayed).  The exception is:  
System.Security.Cryptography.CryptographicException: Padding is invalid and 
cannot 
be removed.

Another example is System.FormatException: Invalid character in a Base-64 
string.  
System.Web.HttpException: The client disconnected. ---> 
System.Web.UI.ViewStateException: Invalid viewstate. 

Original comment by wayne.br...@gmail.com on 27 Jun 2007 at 5:35

GoogleCodeExporter commented 9 years ago
Thanks for getting back with those examples because it helps to clear up the 
discussion with concrete scenarios. Isn't filtering precisely what you want 
here 
though? In other words, the error is still returned to the user agent (e.g. a 
500 to 
Googlebot) but you don't want to be bothered by it in your logs and mail. If 
you 
suppress the error on the server then the user agent gets back a 200 response, 
which 
runs the risk of something like Googlebot caching as a logically invalid 
reponse for 
the request.

Original comment by azizatif on 27 Jun 2007 at 8:33