Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Exception Trapping
Message
From
21/12/2007 16:50:50
 
 
To
21/12/2007 08:41:17
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
01276890
Message ID:
01277090
Views:
19
Bill,

We do basically the same thing. It will trap any errors that aren't handled in other parts of your code. This is mainly used as a catch-all in case you've forgotten a try/catch elsewhere in your program.

In addition we have Error classes that handle displaying the Error message ... client-side errors get displayed to the user, server-side errors get logged in the Application Event Log.

~~Bonnie



>Hi Einar,
>
>Thanks for the reply. Yes, I can see doing that, but I'm not sure that will trap all lower level errors and have to believe there is a way to insure that they are trapped. I will research it more and we can see if anyone else weighs in with more info.
>
>Bill
>
>>I think the answer to your question is no, but I always wrap my main in a try catch to catch (and log) any exception that is unhandeled. Something like this:
>>
>>[STAThread]
>>static void Main()
>>{
>>	try
>>	{
>>		Application.EnableVisualStyles();
>>		Application.SetCompatibleTextRenderingDefault(false);
>>		Application.Run(new MyForm());
>>	}
>>	catch (Exception ex)
>>	{
>>		MessageBox.Show(ex.Message);
>>	}
>>}
>>
>>
>>
>>>In ASP.NET we can use the Application_Error() method of Global.asax to implement global error trapping to insure any untrapped errors still get trapped and addressed.
>>>
>>>Is there an equivalent methodology in a Winforms application for trapping "untrapped" execptions at a global level so they can be addressed?
>>>
>>>Thanks,
>>>Bill
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform