When making my hobby projects I've typically used a system where certain functions return true or false values to indicate if an error occurred.
For Example: main calls class A, class A has a function called bool setup(). Class A has a member class C, which also needs to setup some stuff and has a bool load() function.
now with the given structure, I have to have an if/then statement when using C::load() inside the setup(). Main calls setup() so I have to use an if/then statement to evaluate it ad decide whether to go on or not.
What I'm asking is this cascading bool checking a waste of time or do exceptions correct that problem.
I've found that with exceptions a similar problem can occur where main has to try and catch exceptions thrown from setup(), which in turn has to try and catch exceptions thrown from load(). It's a similar process but with try/catch statements instead of if statements.
What is the "proper" method of error handling in the case of multiple programs or functions cascading errors down to base calling functions.



LinkBack URL
About LinkBacks



CornedBee