Red Gate forums :: View topic - Improvement for error reporting
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

Improvement for error reporting

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
GieltjE



Joined: 24 Aug 2013
Posts: 13

PostPosted: Sat Oct 26, 2013 11:10 am    Post subject: Improvement for error reporting Reply with quote

The error reporting form doesn't send the exception data, below is a modified snippet that adds this data (in most cases this contains a lot of useful data (for instance mysql errors will add the error code), and when calling ExceptionReporting.Report it allows for easy adding of environment variables).

Code:
       readonly List<string> _keys = new List<string>();
       readonly List<string> _values = new List<string>();

        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs) : this()
      {
         int newHeight = Height;

            try
            {
                _values.AddRange(from object value in reportExceptionEventArgs.Exception.Data.Values select value.ToString());
                _keys.AddRange(from object key in reportExceptionEventArgs.Exception.Data.Keys select key.ToString());

                int countOnlyOnce = _keys.Count;
                for (int i = 0; i < countOnlyOnce; i++)
                {
                    reportExceptionEventArgs.AddCustomProperty(_keys[i], _values[i]);
                }
            }
            catch (Exception) {}


Why isn't something like this added to the defualt exception handlers?
Back to top
View user's profile Send private message
jessica.ramos



Joined: 23 Apr 2012
Posts: 230

PostPosted: Mon Oct 28, 2013 5:50 pm    Post subject: Reply with quote

Hi there,

Thank you for your post!

We've got a feature request to add the exception data to the default exception reporting templates (with internal reference SA-264) and I've +1'd this request with your information--thank you for your feedback!

Many thanks as well for sharing your solution for this. Smile
_________________
Jessica Ramos
Technical Support
Red Gate Software Ltd.
Back to top
View user's profile Send private message
GieltjE



Joined: 24 Aug 2013
Posts: 13

PostPosted: Sat Nov 02, 2013 9:44 am    Post subject: Reply with quote

One of the other interesting things you can do with this is make the exception reporter behave differently when you set a certain value.
For example I used it to be able to send some reports silently without user interaction (Visible = false; ShowInTaskbar = false; and some other small hacks needed).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group