473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Global Error Handling

OHM
Hi everyone,

I have a problem with error handling and wondered if anyone has managed to
implement a global exception handling model.

Is it possible to ensure that you see all exceptions before it becomes an
unhandled exception.

This is opposale to putting Try Catches around every statement

Regards - OHM
Nov 20 '05 #1
5 2075
Hi, OHM

you will catch all unhandled exceptions if you will enclose whole body of
your Main method in try-catch. However note this is valid only for main
thread. If you start other threads, you have to use try-catch in each thread
start delegate as well.

HTH
Alex

"OHM" <Me@NoWhere.Com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi everyone,

I have a problem with error handling and wondered if anyone has managed to
implement a global exception handling model.

Is it possible to ensure that you see all exceptions before it becomes an
unhandled exception.

This is opposale to putting Try Catches around every statement

Regards - OHM

Nov 20 '05 #2
global error handleing doesnt work in all instances... I have one over my
application but sometimes i get an error that is out of range of the error
handler and it catches the error at an unknown location or type but it still
caught the error. it seems if you want to get complete inormation you need
to do local exception checking and not over the whole app or the messages
returned may not be usasble in terms of debugging.
"OHM" <Me@NoWhere.Com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi everyone,

I have a problem with error handling and wondered if anyone has managed to
implement a global exception handling model.

Is it possible to ensure that you see all exceptions before it becomes an
unhandled exception.

This is opposale to putting Try Catches around every statement

Regards - OHM

Nov 20 '05 #3
Hi OHM,

Monday and tuesday there has been a very long and intresting arguing in the
newsgroup microsoft.public.dotnet.general

I do not know if it fullfils your needs. However I think it is worh for you
reading it

After a few starting messages it becomes very good in my opinion.

http://www.google.com/gr************...TNGP09.phx.gbl

Cor
Nov 20 '05 #4
* "OHM" <Me@NoWhere.Com> scripsit:
I have a problem with error handling and wondered if anyone has managed to
implement a global exception handling model.

Is it possible to ensure that you see all exceptions before it becomes an
unhandled exception.

This is opposale to putting Try Catches around every statement


<URL:http://www.google.de/groups?selm=u3136qU5DHA.632%40TK2MSFTNGP12.phx.gbl >

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
OHM,
In addition to the others comments.

Depending on the type of application you are creating, .NET has three
different global exception handlers.

For ASP.NET look at:
System.Web.HttpApplication.Error event
Normally placed in your Global.asax file.

For console applications look at:
System.AppDomain.UnhandledException event
Use AddHandler in your Sub Main.

For Windows Forms look at:
System.Windows.Forms.Application.ThreadException event
Use AddHandler in your Sub Main.

It can be beneficial to combine the above global handlers in your app, as
well as wrap your Sub Main in a try catch itself.

There is an article in the June 2004 MSDN Magazine that shows how to
implement the global exception handling in .NET that explains why & when you
use multiple of the above handlers...

http://msdn.microsoft.com/msdnmag/is...6/default.aspx

Unfortunately the article is not on-line yet.

Hope this helps
Jay
"OHM" <Me@NoWhere.Com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi everyone,

I have a problem with error handling and wondered if anyone has managed to
implement a global exception handling model.

Is it possible to ensure that you see all exceptions before it becomes an
unhandled exception.

This is opposale to putting Try Catches around every statement

Regards - OHM

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
2
by: VM | last post by:
Is it possible to intercept all exception errors into one Try...Catch? I've tried wrapping Application.Run() in a Try...Catch, but it doesn't seem to work all the time. Thanks.
2
by: Jim Slade | last post by:
I'd like to be able to log each error that occurs in an ASP.NET application. Do I really need to have a try/catch block in every single one of my methods? Is there a way to somehow handle ALL...
2
by: tshad | last post by:
I have my error handling set up in Global.asax: Sub Application_Error(Sender As Object, E as EventArgs) In this procedure I call a function in a dll that will write out to a history file. ...
3
by: Doug | last post by:
Using Visual Studio 2005, SQL Server 2000, and ASP.NET/VB.NET for a Web Application. We have a System DSN using Windows NT authentication defined on the development box to connect to the SQL...
2
by: ===Steve L.=== | last post by:
does anyone know any site or ariticle provides exmaple for building a Global Error Handling Module in VB.Net? the module should be able to 1. prouduce friendly generic error msg for the users and...
24
by: onnodb | last post by:
Hi all, Currently, I'm working on an Access XP database app that uses two global objects in its code. These two objects are instances of "controller classes". For example, one of them manages...
7
by: Jason Kester | last post by:
Best I can tell, there are three basic ways you can deal with global error handling in ASP.NET. Namely: 1. Derive all your pages from a custom Page class, and override OnError() 2. Specify a...
1
by: John | last post by:
Hi I have a winform app with try/catch error handling implemented in key areas. Problem is errors can occur in other areas in situations that I may not foresee. Is there a way to implemented a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.