Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error handling and exception message
Message
From
17/11/2003 14:52:57
 
 
To
17/11/2003 10:30:05
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00850464
Message ID:
00850749
Views:
13
>The reason is that .NET is using .WriteLine to form the error message. The "dot, carriage return plus another character" that you see is a period (to end the sentence), and a NewLine (CR+LF).
>
>You might want to stay away from using the error message text in the logic of your code. You can probably accomplish the same function by using multiple Catches, one for each derived type of Exception:
>
>Catch e As System.Data.SqlClient.SqlException
>lcError = "The Query doesn't work!"
>.
>.
>Catch e As Exception
>lcError = "Generic error"
>
>.Net will automatically step through the Catches until it finds one that it can cast the thrown Exception to. I.e., the Catch that specifies a type that is somewhere in the derivation chain of the thrown Exception.
>
>What makes this very useful is that the online help is fairly consistient about listing the possible exceptions that can be thrown when calling a Method of a class. What isn't so great is that all of the Exceptions are spread out in different namespaces. But this shouldn't be a problem in code because you are most likely already using the namespace to call the Method.

Ok, thanks for all that.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform