{"@context":"https://w3id.org/codemeta/3.0","@type":"SoftwareSourceCode","identifier":"pkg:golang/github.com/lainio/err2","name":"github.com/lainio/err2","description":"Package err2 is error handling solution including three main functionality:\n\nThe err2 package drives programmers to focus on error handling rather than\nchecking errors. We think that checks should be so easy that we never forget\nthem. The CopyFile example shows how it works:\n\nThe github.com/lainio/err2/try package provides convenient helpers to check the errors. For example,\ninstead of\n\nwe can write\n\nNote that try.To functions are as fast as if err != nil statements. Please see\nthe github.com/lainio/err2/try package documentation for more information\nabout the error checks.\n\nerr2 offers optional stack tracing. And yes, it's fully automatic. Just call\n\nat the beginning your app, e.g. main function, or set the tracers\nprogrammatically (before flag.Parse if you are using that):\n\nNote that since Catch's default mode is to recover from panics, it's a good\npractice still print their stack trace. The panic tracer's default values is\nos.Stderr. The default error tracer is nil.\n\nNote that both panic and error traces are optimized by err2 package. That means\nthat the head of the stack trace isn't the panic function, but an actual line\nthat caused it. It works for all three categories:\n\nThe last two types are handled as panics in the error handling functions given\nto Handle and Catch.\n\nSame err2 capablities support automatic logging like the Catch and\n[try.Result.Logf] functions. To be able to tune up how logging behaves we offer a\ntracer API:\n\nThe err2 package supports Go's flags. All you need to do is to call flag.Parse.\nAnd the following flags are supported (=\"default-value\"):\n\nNote that you have called SetErrorTracer and others, before you call\nflag.Parse. This allows you set the defaults according your app's need and allow\nend-user change them during the runtime.\n\nPackage err2 relies on declarative control structures to achieve error and panic\nsafety. In every function which uses err2 or try package for error-checking has\nto have at least one declarative error handler if it returns error value. If\nthere are no error handlers and error occurs it panics. We think that panicking\nfor the errors is much better than not checking errors at all. Nevertheless, if\nthe call stack includes any err2 error handlers like Handle the error is\nhandled where the handler is saved to defer-stack. (defer is not lexically\nscoped)\n\nerr2 includes many examples to play with like previous CopyFile. Please see them\nfor more information.","version":"v1.2.3","softwareVersion":"v1.2.3","license":"https://spdx.org/licenses/MIT","codeRepository":"https://github.com/lainio/err2","issueTracker":"https://github.com/lainio/err2/issues","url":"https://github.com/lainio/err2","programmingLanguage":{"@type":"ComputerLanguage","name":"Go"},"dateCreated":"2020-10-24","dateModified":"2025-11-14","datePublished":"2025-11-14","copyrightYear":2020,"downloadUrl":"https://proxy.golang.org/cached-only/github.com/lainio/err2/@v/v1.2.3.zip","softwareHelp":{"@type":"WebSite","url":"https://pkg.go.dev/github.com/lainio/err2#section-documentation"},"applicationCategory":"go","runtimePlatform":"go","developmentStatus":"active","sameAs":["https://pkg.go.dev/github.com/lainio/err2"],"https://www.w3.org/ns/activitystreams#likes":74,"https://forgefed.org/ns#forks":8}