Skip to content

Few questions #4

Answered by lainio
qwerty2586 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, and thank you very much for your comments and questions. They are highly appreciated!

Simple way to overwrite errors?

The current err2 package follows the Go2 try-proposal, where you add as many deferred error handlers as your function needs.

If I understand your question right, you would like to know what was the specific try.To which triggered the error. The preferred (and only) way is to use as many deferred err2.Handle or err2.Returnf. The order of the handlers tells what to do in the particular error handler. Please see the following playground. There is just one err2.Handle for the cleanup. The first one, err2.Returnf, annotates the error. Both are called when there is an err…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lainio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants