proxy.golang.org : github.com/jsouthworth/try
Package try is a Try/Catch implementation. A common pattern when needing to protect a section of code from panics, such as calling plugins or passing errors from deep in a recursive tree, is to use defer func() { recover() ... }() this is more or less the try catch pattern from other languages. This implementation generalizes that pattern and makes it easier to use. Unlike other languages, this turns a call into a value and a go error. Any caught value is transformed to an error. If it is already an error then it is passed along as is, otherwise fmt.Errorf is used to create an error. If one panics within an exeception this will become the returned error.
Registry
-
Source
- Documentation
- JSON
- codemeta.json
purl: pkg:golang/github.com/jsouthworth/try
License: 0BSD
Latest release: 13 days ago
Namespace: github.com/jsouthworth
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 13 days ago