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

Continuing execution after caught exception

Hi,

I have the following code:

for (int i=0;i<childOptimizations.Length;i++) //for each partition

{

row = childOptimizations[i];

if (i==0)

dataManager.UpdateAvailabilityWithLegsFromExisting Trips(System.Convert.ToInt
32(row["SCHOPT_ID"]));

else

dataManager.UpdateAvailabilityWithLegsFromExisting Optimization(System.Conver
t.ToInt32(previousRow["SCHOPT_ID"]),System.Convert.ToInt32(row["SCHOPT_ID"])
);

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));

catch

{

}

childOptimizations=dataManager.SCHEDULE_OPTIMIZATI ON.Select("PARENT_SCHOPT_I
D="+optimizationID);

previousRow=childOptimizations[i];

}

Even though the optimizationEngine.optimize might thorw an exception, I
still want to the loop and run the other optimizations.

I know I can turn optimizationEngine.optimize method to return an error code
instead of throwing an exception, but I am baffled as to why I can't
continue the execution with optimizationEngine.optimize throwing an
exception.

Thanks


Jul 21 '05 #1
1 2033
Hi:

You should put the "optimizationEngine.optimize(.......);" inside another
nested try-catch block
Ex:

try
{
// Put here the code you have
// put this line into the nested try catch block
// optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));
try
{

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));
}
catch
{
// skip the exeption
}

// the program flow continues here, even when optimizationEngine.optimize
threw an exception
}
catch
{
}

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));

"Tolga Erdogus" <to**********@alum.mit.edu> escribió en el mensaje
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I have the following code:

for (int i=0;i<childOptimizations.Length;i++) //for each partition

{

row = childOptimizations[i];

if (i==0)

dataManager.UpdateAvailabilityWithLegsFromExisting Trips(System.Convert.ToInt 32(row["SCHOPT_ID"]));

else

dataManager.UpdateAvailabilityWithLegsFromExisting Optimization(System.Conver t.ToInt32(previousRow["SCHOPT_ID"]),System.Convert.ToInt32(row["SCHOPT_ID"]) );

optimizationEngine.optimize(System.Convert.ToInt32 (row["SCHOPT_ID"]));

catch

{

}

childOptimizations=dataManager.SCHEDULE_OPTIMIZATI ON.Select("PARENT_SCHOPT_I D="+optimizationID);

previousRow=childOptimizations[i];

}

Even though the optimizationEngine.optimize might thorw an exception, I
still want to the loop and run the other optimizations.

I know I can turn optimizationEngine.optimize method to return an error code instead of throwing an exception, but I am baffled as to why I can't
continue the execution with optimizationEngine.optimize throwing an
exception.

Thanks

Jul 21 '05 #2

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

Similar topics

2
by: Mark | last post by:
Hello all, I know why the following doesn't work ... I can't figure out how to make it work like I want it to. Basically, I only want the loop computing fibonacci numbers to run for approx 5...
3
by: omission9 | last post by:
Any advice on the following would be much appreciated. I have thrown everything I have at it and am completely stumped. I apologize for the length, I have tried to be as succint as possible. I...
9
by: Joe Rigley | last post by:
Hello, As a .NET newbie I'd appreciate some advice... I've been tasked with writing a small app (in VB .NET) that takes some data from our HR system, does some format modifications, and loads...
2
by: James Cooke | last post by:
Hi all, I want to catch a duplicate key exception. I do not want to provide that verbose message from the MSSQL server - I would put a user friendly message out, like "The item you have added...
1
by: Tolga Erdogus | last post by:
Hi, I have the following code: for (int i=0;i<childOptimizations.Length;i++) //for each partition { row = childOptimizations;
3
by: RSH | last post by:
Hi, I have two questions both by a VB programmer that is learning C#... 1) In a VB error trap routine we would commonly trap the error and write it to an error log and then attempt to "Resume...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
6
by: daniel | last post by:
I use a simple program to illustrate the problem: import logging def foo() : raise ValueError("foo") if __name__ == "__main__" : try : foo()
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
in event log:.NET Runtime version 2.0.50727.312 - Fatal Execution Engine Error (7A062A61) (80131506) We have an application that seems to be throwing this error, but I can't seem to work out why...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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,...

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.