473,398 Members | 2,368 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,398 software developers and data experts.

Do something on an uncaught exception.

Bob
Hi all,

I have a small helper service that is peppered with try-catches for all the
exceptional cases I could think of.
It industriously logs every error it comes across for debugging later on.

Wonderful; however on the odd time it blows a gasket the solution is in
99.9% the same .. restart the service.
Then go away and track down the source of the bug fix-test-deploy.
usually a 5 min fix .. but often a call at 3am ...

Is there a mechanism for catching these "uncaught" exceptions in the
application so that I could then launch another instance of the service and
gracefully close down the 'afflicted' app.

regards Bob

p.s. .. I'm sure explorer.exe does this .. it seems to hang and restart all
the time.
Aug 8 '07 #1
6 2563
"Bob" <no*******@nospamSam.com.auwrote in message
news:e9**************@TK2MSFTNGP04.phx.gbl...
Hi all,

I have a small helper service that is peppered with try-catches for all
the exceptional cases I could think of.
It industriously logs every error it comes across for debugging later on.

Wonderful; however on the odd time it blows a gasket the solution is in
99.9% the same .. restart the service.
Then go away and track down the source of the bug fix-test-deploy.
usually a 5 min fix .. but often a call at 3am ...

Is there a mechanism for catching these "uncaught" exceptions in the
application so that I could then launch another instance of the service
and gracefully close down the 'afflicted' app.
Application.ThreadException += new blah....

I'm not sure if you need to do this for each thread you create so it would
be worth testing here. With a service though don't you have a single point
that calls all code so can trap everything there? This is what I have and
don't need to restart the service.

Michael
Aug 8 '07 #2
>>Is there a mechanism for catching these "uncaught" exceptions in the
application so that I could then launch another instance of the service and
gracefully close down the 'afflicted' app.
>Application.ThreadException += new blah....
If that does not catch everything you might also try the

AppDomain.CurrentDomain.UnhandledException += ....
hth,
Alan.

Aug 8 '07 #3
I am assuming that you are in .net. If so then above the page level which you seem to be catching there are the application level of global.aspx and also the last level below the server of web.config. Both have error traps that you can use. However, there are some errors that are a the server level that never get to the application and those are handled by the server. Look at Application_Error in global.aspx; and customerrors in the web.config.

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Aug 8 '07 #4
Bob
Thanks for this .. I'll give it a shot ...

regards Bob
Aug 9 '07 #5
In article <e2**************@TK2MSFTNGP04.phx.gbl>, Michael C wrote:
In a service most code will start from a single point which will probably be*
a timer, so it's easy to catch any exception there.
Except for thread pool threads and asynchronous callback threads. For instance,
an exception thrown in a handler for completion of a socket receive needs to be
handled in a try/catch handler (or by the handler for
AppDomain.CurrentDomain.UnhandledException) as Allan suggested.

Mike

Aug 13 '07 #6
"Mike Blake-Knox" <mi****@community.nospamwrote in message
news:VA******************@community.nospam...
Except for thread pool threads and asynchronous callback threads. For
instance,
an exception thrown in a handler for completion of a socket receive needs
to be
handled in a try/catch handler (or by the handler for
AppDomain.CurrentDomain.UnhandledException) as Allan suggested.
Excellent suggestion. This could be a problem in my service, I noticed some
exceptions not getting handled when I was developing even though I thought
everything should be caught. I think I probably eliminated them just by
fixing whatever was causing the exception but it would definately be worth
me revisiting it. Thanks for the tip.

Michael
Aug 13 '07 #7

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

Similar topics

6
by: Matt Bostock | last post by:
Hi, When I validate this page: http://www.drfunkenstein.net/using http://jigsaw.w3.org/css-validator/, I get the following results: ...
4
by: nrhayyal | last post by:
hi all, i am facing a problem in catching an exception which is uncaught in any of the catch block. not doing so will gives me coredump. I tried by rewriting set_unexpected() and set_terminate()...
7
by: meaneyedcat | last post by:
When I call addField(), my table appears to be populated correctly with a new row in the table with all the required fields. However, when I call delete row on any new rows that have been created,...
3
by: c.prerovsky | last post by:
Hi there, I started messing around with JavaScript OOP a few days ago and still can't get this one to work. There are many things wich keep confusing me, eg. the various ways to define a class...
5
by: -Lost | last post by:
Error: uncaught exception: " nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: file:///D:/sites/_test/js/iterate_document.htm :: <TOP_LEVEL:: line 15" data: no] Line 15...
0
by: maweb | last post by:
Hello i'm becoming mad at trapping this exception: EventType clr20r3, P1 execwinservice.exe, P2 1.0.0.0, P3 45eec745, P4 system.data, P5 2.0.0.0, P6 4333aea2, P7 2323, P8 11, P9...
3
by: George2 | last post by:
Hello everyone, Just want to check whether my understanding is correct, Both (1) and (2) only covers Windows C++ platform. 1. If there is uncaught exception, destructor is not ensured to...
2
by: josephx | last post by:
Hello, I got some of these errors listed below after executing an HTTP Post MIDlet on CLDC/MIDP platform, "Nokia S40 DP 2.0 SDK 1.1" and "S40 5th Edition SDK Feature Pack 1" and even for S60's...
3
by: friend | last post by:
Error: uncaught exception: " nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://manimekalai/VulnMgmt/scanfi/crs_source/vulnupdate/latest.php?vulnerability=2451 ::...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.