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

Top 4.0% on proxy.golang.org
Top 1.2% dependent packages on proxy.golang.org
Top 0.3% dependent repos on proxy.golang.org
Top 8.9% forks on proxy.golang.org
Top 0.5% docker downloads on proxy.golang.org

proxy.golang.org : github.com/pingcap/errcode

Package errcode facilitates standardized API error codes. The goal is that clients can reliably understand errors by checking against immutable error codes This godoc documents usage. For broader context, see https://github.com/pingcap/errcode/tree/master/README.md Error codes are represented as strings by CodeStr (see CodeStr documentation). This package is designed to have few opinions and be a starting point for how you want to do errors in your project. The main requirement is to satisfy the ErrorCode interface by attaching a Code to an Error. See the documentation of ErrorCode. Additional optional interfaces HasClientData, HasOperation, Causer, and StackTracer are provided for extensibility in creating structured error data representations. Hierarchies are supported: a Code can point to a parent. This is used in the HTTPCode implementation to inherit HTTP codes found with MetaDataFromAncestors. The hierarchy is present in the Code's string representation with a dot separation. A few generic top-level error codes are provided (see the variables section of the doc). You are encouraged to create your own error codes customized to your application rather than solely using generic errors. See NewJSONFormat for an opinion on how to send back meta data about errors with the error data to a client. JSONFormat includes a body of response data (the "data field") that is by default the data from the Error serialized to JSON. Stack traces are automatically added by NewInternalErr and show up as the Stack field in JSONFormat. Errors can be grouped with Combine() and ungrouped via Errors() which show up as the Others field in JSONFormat. To extract any ErrorCodes from an error, use CodeChain(). This extracts error codes without information loss (using ChainContext).

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/pingcap/errcode
License: Apache-2.0
Latest release: about 6 years ago
First release: about 6 years ago
Namespace: github.com/pingcap
Dependent packages: 18
Dependent repositories: 388
Stars: 14 on GitHub
Forks: 4 on GitHub
Docker dependents: 24
Docker downloads: 4,053,522
See more repository details: repos.ecosyste.ms
Last synced: about 23 hours ago