Depends on how you are attempting to handle the exception.
If you are using a "try catch" block, then you will need to use the exception object's number &/or message properties. For example:
catch e as exception
...code to gracefully handle exception..
lblMessages.text = "The following error occurred: '" & e.message & "'.<br>Error Code: '" & e.number & "'.
Just be sure that if you do something like this that there is a label name "lblMessages.text" in your .aspx page. ;)
I know the above uses both the .number & .message properties, but you get the idea.