do try/catches cascade?

D

darrel

Not sure if that's the proper term.

Let's say I have this:

function function1()
try
do something
function2()
catch
error
end try
end function


function function2()
try
do something
catch
error
end try
end function

When function 1 is called, will it abort if function 2 also aborts? Or will
function 1 do whatever it can regardless of whether function 2 aborts or
not?

-Darrel
 
M

Mark Rae

When function 1 is called, will it abort if function 2 also aborts? Or
will
function 1 do whatever it can regardless of whether function 2 aborts or
not?

What did you observe when you tried it for yourself...?
 
D

darrel

What did you observe when you tried it for yourself...?

I'm not there yet...still building...will report back... ;o)

-Darrel
 
K

Kevin Spencer

Good question darrel.

Exceptions "bubble up," which means that when an exception occurs, and is
not handled, it is passed to the calling function. So, if the calling
function doesn't handle it, it throws the same exception, which is then
passed to the function that called IT. And so on. So, whether the exception
bubbles up is determined by whether or not the exception is caught and
handled gracefully in the function in which it is thrown.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
 
D

darrel

Exceptions "bubble up," which means that when an exception occurs, and is
not handled, it is passed to the calling function. So, if the calling
function doesn't handle it, it throws the same exception, which is then
passed to the function that called IT. And so on. So, whether the exception
bubbles up is determined by whether or not the exception is caught and
handled gracefully in the function in which it is thrown.

Thanks, Kevin. That explains it nicely.

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,010
Latest member
MerrillEic

Latest Threads

Top