Exceptions not being caught
I am having a problem with exceptions not being caught
even though I am catching "any" exception.
I am querying millions of records from a table.
After 20 min, unexpectedly, my script jumps to the
finally() block and ends the script.
I'm not sure whether the query returned with an exception
which didn't get caught, or whether the script itself timed out,
and went directly to finally() to end the script.
Here is basically what I'm doing:
//=====================================
// queryData()
//=====================================
public void function queryData() {
try {
FileWriteLine(myfile, "Executing query");
myquery = new query();
myquery.execute(.....);
FileWriteLine(myfile, "Got data");
} catch (any ex) {
FileWriteLine(myfile, "Query failed");
rethrow;
}
}
//=====================================
// main()
//=====================================
try {
FileWriteLine(myfile, "Before queryData()");
queryData();
FileWriteLine(myfile, "After queryData()");
} catch (any ex) {
FileWriteLine(myfile, "FAILED");
} finally {
FileWriteLine(myfile, "DONE");
}
//=====================================
My output file (myfile) contains (which shouldn't be possible):
Before queryData()
Executing query
DONE
If it had succeeded, myfile should have:
Before queryData()
Executing query
Got data
After queryData()
DONE
If it had failed, myfile should have:
Before queryData()
Executing query
Query failed
FAILED
DONE
Does anyone know what might be going wrong?
Thanks.
myscreenname0345
