Skip to content

Commit

Permalink
update README and link to blog
Browse files Browse the repository at this point in the history
  • Loading branch information
gregwebs committed Jan 23, 2025
1 parent 9c24984 commit 18ee575
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,30 @@ errcode supports hierachy and associating to metadata such as HTTP codes.
The common simple form of this is to properly attach an HTTP code to an error.
When clients need to react to specific errors, both the HTTP code and a more specific error code can be associated to the error.

See [this blog post](https://blog.gregweber.info/blog/go-error-codes/) for more introduction and documentation.

See the [go docs](https://godoc.org/github.com/gregwebs/errcode) for extensive API documentation.

## Status

This library has been used in production for years.
The core types and API have not changed but there is ongoing experimentation with newer APIs.

# errcode overview
## Features

* structured error representation
* Uses the Unwrap model where errors can be annotated and the underlying code can be unwrapped
* Internal errors show a stack trace but others don't.
* Operation annotation. This concept is [explained here](https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html).
* Works for multiple errors when the Errors() interface is used. See the `Combine` function for constructing multiple error codes.
* Extensible metadata. See how SetHTTPCode is implemented.
* Integration with existing error codes
* HTTP
* GRPC (provided by separate grpc package)
* GOA error types (provided by separate goa package)


## Overview

This package extends go errors via interfaces to have error codes.

Expand Down Expand Up @@ -56,20 +74,6 @@ type HasUserMsg interface {

A UserCode can be created with `errcode.WithUserMsg` or `errcode.UserMsg`.

See the [go docs](https://godoc.org/github.com/gregwebs/errcode) for extensive API documentation.

## Features

* structured error representation
* Uses the Unwrap model where errors can be annotated and the underlying code can be unwrapped
* Internal errors show a stack trace but others don't.
* Operation annotation. This concept is [explained here](https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html).
* Works for multiple errors when the Errors() interface is used. See the `Combine` function for constructing multiple error codes.
* Extensible metadata. See how SetHTTPCode is implemented.
* Integration with existing error codes
* HTTP
* GRPC (provided by separate grpc package)


## Comparison

Expand Down

0 comments on commit 18ee575

Please sign in to comment.