Unhandled exception message
-
Just making some changes on my project, found this pearl on a catch block which was the subject, wrapper with the exception message and stack trace: errormessages += "Fatal error. Please Restart. We are sorry." + sessionExp.Message + ";" + sessionExp.StackTrace;
-
Just making some changes on my project, found this pearl on a catch block which was the subject, wrapper with the exception message and stack trace: errormessages += "Fatal error. Please Restart. We are sorry." + sessionExp.Message + ";" + sessionExp.StackTrace;
Not sure what the horror is. Looks like it is just accumulating error messages (though a list or StringBuilder would seem more appropriate). By the way, you may want to toss that code in a PRE block.
-
Just making some changes on my project, found this pearl on a catch block which was the subject, wrapper with the exception message and stack trace: errormessages += "Fatal error. Please Restart. We are sorry." + sessionExp.Message + ";" + sessionExp.StackTrace;
-
If this is .Net, the horror is using .Message instead of .ToString() which will already include the StackTrace
Not sure I would call that a horror either. The ToString might include the stack trace, but even if it does it probably doesn't have the message in front of the rest of the stack trace, as is the case with this example. If this is a log that is meant to be read by humans, it would seem smart to put the message ahead of the rest so people can avoid having to scan through the stack trace to get to the most important part.
-
Not sure I would call that a horror either. The ToString might include the stack trace, but even if it does it probably doesn't have the message in front of the rest of the stack trace, as is the case with this example. If this is a log that is meant to be read by humans, it would seem smart to put the message ahead of the rest so people can avoid having to scan through the stack trace to get to the most important part.
I think the "We are sorry" bit is the horror. You never admit liability. The correct message should read: "You screwed up the system again. Look here's a stack trace of all the functions you broke. Call the Helpdesk and apologise and maybe...just maybe we can get this sh*t working before Monday. You've made me miss my sons soccer game tomorrow. You do realise that don't you? He'll be heartbroken. He still hasn't recovered from the weekend you made me miss his brithday by trying to print an end of month report in the middle of the month. It's called the end of month for a reason you MORON. Do you care? Noooo, you're a user, you swan in here Monday to Friday, breaking systems when you feel like it. You'll probably spend the weekend fishing." -Rd
Hit any user to continue.
-
I think the "We are sorry" bit is the horror. You never admit liability. The correct message should read: "You screwed up the system again. Look here's a stack trace of all the functions you broke. Call the Helpdesk and apologise and maybe...just maybe we can get this sh*t working before Monday. You've made me miss my sons soccer game tomorrow. You do realise that don't you? He'll be heartbroken. He still hasn't recovered from the weekend you made me miss his brithday by trying to print an end of month report in the middle of the month. It's called the end of month for a reason you MORON. Do you care? Noooo, you're a user, you swan in here Monday to Friday, breaking systems when you feel like it. You'll probably spend the weekend fishing." -Rd
Hit any user to continue.
That's awesome. I should have tried those messages in my college projects... :laugh: