I like to use Try-Catch-Finally blocks in my code in order to provide a more pleasant user experience. When I show an error message to the user, I like to include enough detail that if the user sends me a screen image, then I have a good headstart on solving the problem. I have played with several variations of the 'perfect' error message, and finally have settled on the format below that is user-friendly and still provides lots of needed detail information. I hope you find it helpful.
Dim ErrorMsg as string = "I was unable to perform <>." & vbCrLf & "Please make sure to <>." & vbCrLf & "Suggestions go here." & vbCrLf & vbCrLf & "Detailed Error Information below:" & vbCrLf & vbCrLf & " Message: " & exp.Message & vbCrLf & _" Source: " & exp.Source & vbCrLf & vbCrLf & " Stack Trace:" & vbCrLf & exp.StackTrace
Joe Kunk
No comments:
Post a Comment