473,624 Members | 2,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error Recovery Using Exceptions

I wish to implement error recovery using the Exception mechanism
However, I'm not sure I fully appreciate some of the detail in which
this works.

The code that contains a potential error is included in the Try block.
The Catch block is used to catch this exception. The Finally block
will then execute after the Exception has been handled. My questions
are:

1. If the Exception is caught in the Catch block is this referred to
as 'swallowing the exception'

2.If the Exception that is raised is not caught in the Catch block
then will the code in the Finally block still be executed before the
Exception processing transfers to the next higher Catch block.

3. If the Exception is successfully caught in the Catch block will it
be possible to try to recover from the error and do the Try block
again. That is, can I put the Try/Catch block in a loop and then use
my code to determine when to exit from the loop.

Regards

John L
Nov 17 '05 #1
1 2303
> 1. If the Exception is caught in the Catch block is this referred to
as 'swallowing the exception' No, swallowing is just that - swallowing and pretend it wasn't there
for instance
try
{
bogus code
}
catch
{
}
//contine with code here
2.If the Exception that is raised is not caught in the Catch block
then will the code in the Finally block still be executed before the
Exception processing transfers to the next higher Catch block. Finally blocks are guaranteed to execute. Take that with a grain of salt.
There are instances when the finally blocks don't fire. For most
circumstances, they do.

3. If the Exception is successfully caught in the Catch block will it
be possible to try to recover from the error and do the Try block
again. That is, can I put the Try/Catch block in a loop and then use
my code to determine when to exit from the loop. sure. i do that with regularity.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc, Amazon.com etc
"gemel" <jo***@glenavon 1.demon.co.uk> wrote in message
news:g7******** *************** *********@4ax.c om...I wish to implement error recovery using the Exception mechanism
However, I'm not sure I fully appreciate some of the detail in which
this works.

The code that contains a potential error is included in the Try block.
The Catch block is used to catch this exception. The Finally block
will then execute after the Exception has been handled. My questions
are:

1. If the Exception is caught in the Catch block is this referred to
as 'swallowing the exception'

2.If the Exception that is raised is not caught in the Catch block
then will the code in the Finally block still be executed before the
Exception processing transfers to the next higher Catch block.

3. If the Exception is successfully caught in the Catch block will it
be possible to try to recover from the error and do the Try block
again. That is, can I put the Try/Catch block in a loop and then use
my code to determine when to exit from the loop.

Regards

John L

Nov 17 '05 #2

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

Similar topics

10
9525
by: xixi | last post by:
i have db2 udb v8.1 on windows 64 bit 2003 server, after db2 server start , i found this in the db2diag.log, is this error? 2004-05-05-15.28.30.780000 Instance:DB2 Node:000 PID:1692(db2syscs.exe) TID:2860 Appid:AC10040A.GD5F.00FC56D8BEC5 base sys utilities sqledint Probe:30 Crash Recovery is needed. 2004-05-05-15.28.31.890000 Instance:DB2 Node:000
5
5491
by: Udy | last post by:
Hi, We have a custom application used by a customer on DB2 8.1.5 AIX 5.1, we have tested it with 8.1.0 AIX 5.1 and everything works fine. But with 8.1.5 we get the above error. The other applications connecting to other instances of the database works fine. lsattr -E -l sys0 | grep maxuproc gave the output maxuproc 4096
5
3871
by: NG | last post by:
Hi, We are having DB2-V7.2 DB on AIX 5.2 machine. Recently we upgraded our system to fixpack 13 and activated activate AIX asynchronous IO function. Our DB is going to crash recovery with this error 0xFFFFF707. I have attached the related details. Any suggestions is much appreciated.
7
2017
by: jacob navia | last post by:
Microsoft proposed recently (In the Technical Report 24173 presented to the Standards Comitee) a change in the C library in the sense of more security. Basically, missing size information is passed to the new primitives like strcat_s(), gets_s(), and many others. The good thing in this proposal is that the specifications of the new library are much more precise than in the existing library, an improvement that made me start...
6
9622
by: p175 | last post by:
2006-08-14-17.46.13.656000-240 I1472H436 LEVEL: Warning PID : 1452 TID : 336 PROC : db2syscs.exe INSTANCE: DB2 NODE : 000 DB : SQ4V6 APPHDL : 0-9 APPID: *LOCAL.DB2.060814214011 AUTHID : DB2ADMIN FUNCTION: DB2 UDB, Self tuning memory manager, stmmEnforceMinSizeConstraints, probe:2089 MESSAGE : Unable to find donor to satisfy minSize constraint Does...
3
11188
by: danceli | last post by:
"The log file for database is full. Back up the transaction log for the database to free up some log space." Now I only know this way to deal with that manually, Step1. in option , chance Recovery model from FULL to Simple. Step2: go to task to manually shrink the log file Step3: Change recovery model back from simple to FULL. But by this way, I could get same problem again, the log file is fill,
35
3770
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks gets about 3 or so. It also gets very awkward in nested loops, where you want to check for normal loop processing in the loop condition, not errors. Yes, you could put some generic exit flag in the loop condition, but when you're simply done if...
0
1765
by: JohnQ | last post by:
(The thread "Error Handling Idioms" prompted this post. I meant to post it at the top level, but it got posted as a reply. So here it is again!) An attempt at common defintions: fault: the cause of error. error: a detected fault. error handling: planned processing (perhaps via formal mechanisms) that occurs upon fault detection. error correction: returning a program (or system) back to an error-free
0
3791
by: pavankumarveera | last post by:
how to unblock the CF below error what was the solution. GES: Potential blocker (pid=282) on resource CF-00000000-00000000; enqueue info in file /exlibris/app/oracle/admin/meta4/bdump/meta4_arc0_22455.trc Killing enqueue blocker (pid=282) on resource CF-00000000-00000000 by killing session 189.549GES: Potential blocker (pid=8833) on resource CF-00000000-00000000;
0
8242
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8629
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.