An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/dsnet/try

Package try emulates aspects of the ill-fated "try" proposal using generics. See https://golang.org/issue/32437 for inspiration. Example usage: This package is a sharp tool and should be used with care. Quick and easy error handling can occlude critical error handling logic. Panic handling generally should not cross package boundaries or be an explicit part of an API. Package try is a good fit for short Go programs and unit tests where development speed is a greater priority than reliability. Since the E functions panic if an error is encountered, recovering in such programs is optional. Code before try: Code after try: The E family of functions all remove a final error return, panicking if non-nil. Handle recovers from that panic and allows assignment of the error to a return error value. Other panics are not recovered. HandleF is like Handle, but it calls a function after any such assignment. F wraps an error with file and line information and calls a function on error. It inter-operates well with testing.TB and log.Fatal. Recover is like F, but it supports more complicated error handling by passing the error and runtime frame directly to a function.

Ecosystem
proxy.golang.org
Latest Release
v0.0.3
almost 4 years ago
Versions
3
Dependent Packages
29
Dependent Repos
19
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/dsnet/try
spec
License BSD-3-Clause
Namespace github.com/dsnet
First Release almost 4 years ago
Last Synced 16 days ago
Repository
Stars 170 on GitHub
Forks 5 on GitHub
Docker Dependents 2
Docker Downloads 1,300
Rankings on proxy.golang.org
Overall Top 3.4%
Dependent packages Top 1.1%
Dependent repos Top 1.2%
Forks Top 8.9%
Docker downloads Top 1.3%