elmah-contrib-webapi icon indicating copy to clipboard operation
elmah-contrib-webapi copied to clipboard

Allow selection of which errors to log in the attribute declaration

Open ghost opened this issue 11 years ago • 2 comments

It'd be nice if we could optionally log 400 and 404s. I understand the reasoning in #13, but everyone's use case is different.

What about [ElmahHandleErrorApi(LoggedErrors="400,500-999")] or similar?

ghost avatar Jul 25 '14 06:07 ghost

Hi @voltagex, did you ever end up solving this? I was thinking something along the lines of:

[ElmahHandleErrorApi(Include.AllExcept, 404, 403, 401)]

[ElmahHandleErrorApi(Include.AllExcept, HttpErrorCodeRange.5xx, HttpErrorCodeRange.4xx)]

[ElmahHandleErrorApi(Include.Only, HttpErrorCodeRange.5xx)]

Or multiple attributes working together:

[ElmahHandleErrorApi, Include(HttpErrorCodeRange.5xx), Exclude(500)]

rdingwall avatar Jun 28 '15 12:06 rdingwall

I also ran into this today too. I would like to see 400 errors. For example, when ModelState is invalid a "400 Bad Request" response is returned. In my case, this invalid request would be coming from my front-end written in Angluar (which doesn't log errors, other than to the browser console). So if I get a support ticket that the user got "some weird error", I could at least go and see this in Elmah and determine if there is a bug in the UI code.

mikesigs avatar Sep 02 '15 21:09 mikesigs