1 bookmark for 2024-03-05


Wrapping Errors in Go - How to Handle Nested Errors


By wrapping errors and building well-formatted error messages, we can keep better track of where errors are happening. I often just add the name of the function being called to my error messages, but we can make the message say whatever we want. For example, I’ll often include parameter information in the error so I know which inputs caused the error.