Basically, error handling code and regular code have different purpose/aspect.
So splitting error handling code from regular code is just introducing some type of "goto" structure essentially.
I like handle/check work locally inside function and are resticted not to escape between functions unlike exception are good point.
But I think this design proposal may create a very complicated structure。
If there is only one handle per scope ({ }
), it is resonable, but there are many handles and/or have defers in same scope, make code difficult.
If we have to control error handling finely, error handling code and regular code are mixed like bunch of if err != nil
sentences.