github.com/lainio/err2 (go): Package err2 provides three main functionality:  The traditional error handling idiom in Go is roughly akin to  which applied recursively.  The err2 package drives programmers to focus on error handling rather than checking errors. We think that checks should be so easy that we never forget them. The CopyFile example shows how it works:  The try package provides convenient helpers to check the errors. For example, instead of  we can write  Note that try.ToX functions are as fast as if err != nil statements. Please see the try package documentation for more information about the error checks.  err2 offers optional stack tracing. And yes, it's fully automatic. Just set the tracers at the beginning your app, e.g. main function, to the stream you want traces to be written:  Note. Since err2.Catch's default mode is to catch panics, the panic tracer's default values is os.Stderr. The default error tracer is nil.  Package err2 relies on declarative control structures to achieve error and panic safety. In every function which uses err2 or try package for error-checking has to have at least one declarative error handler if it returns error value. If there are no error handlers and error occurs it panics. We think that panicking for the errors is much better than not checking errors at all. Nevertheless, if the call stack includes any err2 error handlers like err2.Handle the error is handled where the handler is saved to defer-stack. (defer is not lexically scoped)  err2 includes many examples to play with like previous CopyFile. Please see them for more information.
Keywords: assertion-library|error|error-handling|errors|go|golang|stacktrace|try-catch|unit-testing