The tumblelog of
Scott Dowding.

I'm a software developer
in Edmonton, Alberta.

Questions? Email me

• Text Post

Don’t use Exception.Message

I tend to avoid using the Exception.Message property when reporting or logging exceptions and use Exception.ToString() method instead.

The Exception.Message property only contains the exception message where the Exception.ToString() method contains all the good stuff like stack trace and inner exceptions.

Anyone who’s ever felt the pain of production code where the developer only logged the exception message knows what I’m talking about. Why? Because “Object reference not set to an instance of an object” is not very useful all by it’s self.

Notes

  1. dowding posted this

Comments

blog comments powered by Disqus

Stuff I Like

Following