HomeForumResearchGuide
Sign in to reply to forum posts.
Exceptions try/catch?

Hello,

I think I know the answer here but can I please check if there's a way to catch exceptions in Dana programs?

Thanks

anita

hi anita,

Dana's exception model does not have a try/catch concept, but exceptions do not propagate beyond a single stack frame (i.e. a single function call). The typical exception management approaches under this model are to either use a look-before-you-leap approach and test for the condition that would cause an exception before trying the action; or you can encapsulate the risky code inside its own local function call where the exception will be contained.

Hope that helps!

Oh I see, that makes sense, thank you!