Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the InnerException property and any other property that expose exceptions #178

Open
atifaziz opened this issue Aug 25, 2015 · 10 comments

Comments

@atifaziz
Copy link
Member

Originally reported on Google Code with ID 178

In addition to logging the details of the Exception that is logged, get the details
of the InnerException property, if it is non-null, as well as any Exceptions exposed
by the InnerException properties on those Exceptions.

Also, if there are other properties that expose Exceptions (or IEnumerable<T> where
the base of T is Exception), then log those properties as well.

This will allow for a richer Exception report.  For example, Elmah catches a ReflectionTypeLoadException
in my application.  However, what's really of more interest to me is the LoaderExceptions
property, which has other exceptions; the Message property of ReflectionTypeLoadException
is "Unable to load one or more of the requested types. Retrieve the LoaderExceptions
property for more information."

This will be exceptionally important for .NET 4.0 as well, with the new AggregateException
exception.

Reported by [email protected] on 2010-07-05 15:32:19

@atifaziz
Copy link
Member Author

Reported by azizatif on 2010-10-19 00:26:48

  • Status changed: Accepted

@atifaziz
Copy link
Member Author

Similar to the Exception Data dictionary, I think this would be an excellent addition.

Reported by marc.c.lang on 2010-10-28 18:21:26

@atifaziz
Copy link
Member Author

I hope we'll see this implemented soon.
See also http://code.google.com/p/elmah/issues/detail?id=162

Reported by fabrice.marguerie on 2011-05-12 14:58:53

@atifaziz
Copy link
Member Author

See also comment #12[1] in issue #162.

[1] http://code.google.com/p/elmah/issues/detail?id=162#c12

Reported by azizatif on 2011-05-12 21:05:23

@atifaziz
Copy link
Member Author

Had a similar thought - but turned out we had a custom exception that wasnt calling
base with the passed in exception.
As long as we do that, we got the details of the inner exception as this is included
in the toString of Exception

For extending though - be nice if elmah exposed out assinging a Func to methods for
getMessage and getDetails in error.cs - so something like:
Elmah.Error.GetMessage = (e) => e.Message + getExtraExceptionInfo(e);

That way anyone could extend and augment what got logged

Reported by stevebaker2001 on 2012-02-09 13:46:22

@atifaziz
Copy link
Member Author

hi, 
Any idea what version this enhancement will be added?

Reported by andycwk2k on 2012-03-25 15:04:08

@atifaziz
Copy link
Member Author

Bump, this would be useful.

Reported by byter10 on 2012-05-15 13:26:19

@atifaziz
Copy link
Member Author

really would like to see this too

Reported by paul.carroll on 2013-05-09 02:29:40

@atifaziz
Copy link
Member Author

This would be a great addition. I might see if I can't get it into a custom build for
myself, if I do I'll provide a patch.

Reported by kyleheon on 2013-10-04 12:52:09

@Maxwell175
Copy link

I'd like to bump this issue as I believe it is an essential missing feature as it is impossible to find out more specific info about the exception, such as a DbEntityValidationException from Entity Framework, which itself simply says to "See 'EntityValidationErrors' property for more details."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants