github.com/eurielec/bulkerrs (go): This package provides a simple and effective way to collect errors while simplifies the flow complexity of sequential and conditional safety checks.  The exported 'NewErr' and 'NewErrOr' alows initialization with or without a previous 'Errs'. Theses functions work like a wrap around the built-in and 'juju/errors' constructor functions.  Once initialized, 'errs.NewErr' and 'errs.NewErrWithCause' work as a replacement of 'errors.NewErr' and 'errors.NewErrWithCause' that appends the generated jujuErr to the inner errors. Also the function 'errs.Append' appends the submitted error arguments to the inner slice.  A primary use case for this library is to append multiple errors while doing a sequence of checkings.  Would become with github.com/juju/errors:  And with bulkerrs:  There's no longer need to check if the error is nil.  Additionally, bulkerrs makes easy to integrate the errors appendings in the application control flow:  Would become:  And if needed, like in github.com/juju/errors, it's possible to add extra context, and have an advanced control of the application flow:  When you want to check to see if an error is of a particular type, a helper function is normally exported by the package that returned the error, like the 'os' package does.  The underlying cause of the error is available using the 'Cause' function.  The result of the 'Error()' call on an annotated error is the annotations joined with colons, then the result of the 'Error()' method for the underlying error that was the cause.  Obviously recording the file, line and functions is not very useful if you cannot get them back out again.  will return something like:  The first error was generated by an external system, so there was no location associated. The second, fourth, and last lines were generated with Trace calls, and the other two through Annotate. Sometimes when responding to an error you want to return a more specific error for the situation.  This returns an error where the complete error stack is still available, and 'errors.Cause()' will return the 'NotFound' error.
Keywords: errors|errors-stack|go|golang|golang-package|juju-errors