Jan 5, 2021
Hi, while this article is helpful to figure out how recovering works I believe you are demonstrating an antipattern here. The problem with passing control to another function on recovering is that you cannot easily recognize the real reason of a panic and handle it gracefully. I would recommend to employ recovering defer func for logging and cleanup only and avoid proceeding normal execution. In your exsmple If you consider zero to be passed it’s better to handle it before the code panics