This is just another way to deal with errors following Go2 draft structure.
If I understood correctly handle
is used as defer in many proposals, which, could be a drawback in case we want the function to fail as soon as error occurs.
So, a better scenario could be as follows:
- Unhandled error occurs - it is thrown and parent function should handle it
- Handled error occurs -
handle
function catches it and performs some operations before exiting the function (in the handle function one can decide to throw an error again if he/she needs to add additional info to the err)