Reputation: 587
I am a java developer trying to maintain some very old c++ code (still have to use vs2010 to compile).
I am at home trying to understand exceptions without the ability to test stuff, so sorry if this question is stupid.
Can you throw an exception in a low level function and just catch it at the top, or does it have to be caught and re-thrown at every level?
This is complicated by the fact i am writing native code, calling managed code, calling c#, calling my java rest resource. So are there any levels in there I absolutely have to catch and convert then re-throw.
Thank you in advance.
Edit: as Jesper has answered the first half, can my native code handle system::exception?
Upvotes: 1
Views: 439
Reputation: 31465
"Can you throw an exception in a low level function and just catch it at the top" - yes.
"does it have to be caught and re-thrown at every level?" - no.
Upvotes: 7