Im having some issues with Error handling or maybe the understanding thereoff. Say I have a function TopFunction which calls a function MiddleFunction 10 times which again calls a function LowFunction 10 times.
Now If LowFunction throws a fatal error and I have no error handling, access is "reset" so to speak. All variable values are wiped from memory, and code execution is stopped (or possibly paused with debug options if its a development version).
However if I do have error handling and catch a unexpected error (One I did not anticipate and therefore basicly don't know how to handle) I want to quit the LowFunction, BUT I also want to quit MiddleFunction and TopFunction from proceeding. Simply exiting the LowFunction just makes middlefunction proceed with the next function call of LowFunction.
Not exactly sure these are the right words to describe it, but its the best I can do. How should I propagate the error back up through MiddleFunction and TopFunction?
OR
If you feel im barking up the wrong tree, please explain how you guys handle this.
Now If LowFunction throws a fatal error and I have no error handling, access is "reset" so to speak. All variable values are wiped from memory, and code execution is stopped (or possibly paused with debug options if its a development version).
However if I do have error handling and catch a unexpected error (One I did not anticipate and therefore basicly don't know how to handle) I want to quit the LowFunction, BUT I also want to quit MiddleFunction and TopFunction from proceeding. Simply exiting the LowFunction just makes middlefunction proceed with the next function call of LowFunction.
Not exactly sure these are the right words to describe it, but its the best I can do. How should I propagate the error back up through MiddleFunction and TopFunction?
OR
If you feel im barking up the wrong tree, please explain how you guys handle this.
Comment