Click here to Skip to main content
14,095,863 members
Rate this:
Please Sign up or sign in to vote.
See more: , +
I have a website where I want to pass an error code to the user so that QA can look back at the error and figure out what happened. I want to do this without displaying specific error details like the exception message or stack trace to the end user. I wrote the below method that sits inside of the top-level master page for the site and I'm wondering what the best way to call it is if any exception is raised in the application.

The only way to do so that I have thought up of so far is too create try catch blocks in every method in the project but I don't really want to do that.

public void ExceptionHandler(Exception e)
            string s = Guid.NewGuid().ToString();

                throw new Exception(s, e);
            catch (Exception ex)
                throw ex;
                divException.InnerHtml = "An exception has occured, please contact QA for more info.\n Error Code: " + s;

And if, I'm doing this the completely wrong way from the first place feel free to suggest other solutions.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

See these articles for some ideas:

Click me![^]

and me![^]
Kyle Gottfried 15-Aug-13 13:22pm
Thanks for helping out. I've read the tutorial but I'm still having some issues.
Richard C Bishop 15-Aug-13 13:59pm
You are welcome. Excellent job extracting info from those sources and attempting it yourself!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190518.1 | Last Updated 14 Aug 2013
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100