Last post Jul 29, 2020 09:42 AM by Sean Fang
Jul 17, 2020 03:32 PM|aspfun|LINK
In a project, I use try...catch...end try to track error and created two functions.
One function to send an email including "ex.ToString()" to me.
The another function displays "ex.Message" on the screen.
What is the difference between "ex.ToString()" and "ex.Message"?
Catch ex As Exception
Jul 17, 2020 04:00 PM|PatriceSc|LINK
Just have a look. ex.ToString() includes the full exception details (call stack and the whole exception chain if you have an exception which throw another exception etc...).
ex.Message is just the error message for the outer exception.
I prefer to show a generic message as the user usually can't do anything (and possibly understand) this kind of message and it could leak sensitive information. ex.ToString() is much better than ex.Message for developers so that they have the full picture
about which error happens.
Jul 29, 2020 09:42 AM|Sean Fang|LINK
How is your problem going?
If you feel the answer does help, I suggest you can mark the answer as this will help other people who faces the same issue to find the right answer faster.
Thank you for understanding.