Package Usage: go: github.com/ansel1/merry/v2
Package merry adds context to errors, including automatic stack capture, cause chains, HTTP status code, user
messages, and arbitrary values.
Wrapped errors work a lot like google's golang.org/x/net/context package:
each wrapper error contains the inner error, a key, and a value.
Like contexts, errors are immutable: adding a key/value to an error
always creates a new error which wraps the original.
This package comes with built-in support for adding information to errors:
* stacktraces
* changing the error message
* HTTP status codes
* End user error messages
* causes
You can also add your own additional information.
The stack capturing feature can be turned off for better performance, though it's pretty fast. Benchmarks
on an 2017 MacBook Pro, with go 1.10:
This package contains functions for creating errors, or wrapping existing errors. To create:
Additional context information can be attached to errors using functional options, called Wrappers:
Errorf() also accepts wrappers, mixed in with the format args:
Wrappers can be applied to existing errors with Wrap():
Wrap() will add a stacktrace to any error which doesn't already have one attached. WrapSkipping()
can be used to control where the stacktrace starts.
This package contains wrappers for adding specific context information to errors, such as an
HTTPCode. You can create your own wrappers using the primitive Value(), WithValue(), and Set()
functions.
Errors produced by this package implement fmt.Formatter, to print additional information about the
error:
Details() prints the error message, all causes, the stacktrace, and additional error
values configured with RegisterDetailFunc(). By default, it will show the HTTP status
code and user message.
By default, any error created by or wrapped by this package will automatically have
a stacktrace captured and attached to the error. This capture only happens if the
error doesn't already have a stack attached to it, so wrapping the error with additional
context won't capture additional stacks.
When and how stacks are captured can be customized. SetMaxStackDepth() can globally configure
how many frames to capture. SetStackCaptureEnabled() can globally configure whether
stacks are captured by default.
Wrap(err, NoStackCapture()) can be used to selectively suppress stack capture for a particular
error.
Wrap(err, CaptureStack(false)) will capture a new stack at the Wrap call site, even if the err
already had an earlier stack attached. The new stack overrides the older stack.
Wrap(err, CaptureStack(true)) will force a stack capture at the call site even if stack
capture is disabled globally.
Finally, Wrappers are passed a depth argument so they know how deep they are in the call stack
from the call site where this package's API was called. This allows Wrappers to implement their
own stack capturing logic.
The package contains functions for creating new errors with stacks, or adding a stack to `error`
instances. Functions with add context (e.g. `WithValue()`) work on any `error`, and will
automatically convert them to merry errors (with a stack) if necessary.
AddHooks() can install wrappers which are applied to all errors processed by this package. Hooks
are applied before any other wrappers or processing takes place. They can be used to integrate
with errors from other packages, normalizing errors (such as applying standard status codes to
application errors), localizing user messages, or replacing the stack capturing mechanism.
20 versions
Latest release: over 1 year ago
44 dependent packages
View more package details: https://packages.ecosyste.ms/registries/proxy.golang.org/packages/github.com/ansel1/merry/v2
View more repository details: http://repos.ecosyste.ms/hosts/GitHub/repositories/ansel1%2Fmerry
Dependent Repos 75
KotoLLC/peacenik
An ad-free distributed social networkSize: 102 MB - Last synced: 6 months ago - Pushed: 6 months ago

microyahoo/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 73.8 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

zinal/stroppy Fork of picodata/stroppy
Size: 38.2 MB - Last synced: about 1 year ago - Pushed: over 1 year ago

xakdwch/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 46.4 MB - Last synced: about 2 years ago - Pushed: about 2 years ago

avisi-cloud/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 114 MB - Last synced: 4 months ago - Pushed: 10 months ago

liranmauda/noobaa-operator Fork of noobaa/noobaa-operator
Operator for NooBaa (an object data service for hybrid and multi cloud environments) :cloud:Size: 6.18 MB - Last synced: 12 days ago - Pushed: 12 days ago

travisn/rook Fork of rook/rook
Open, Universal, Cloud Native, Distributed StorageSize: 59.2 MB - Last synced: 3 days ago - Pushed: 3 days ago

Seagate/kmip-go Fork of ThalesGroup/kmip-go
KMIP client library in GoSize: 1.22 MB - Last synced: 6 days ago - Pushed: 6 days ago

tangledbytes/noobaa-operator Fork of noobaa/noobaa-operator
Operator for NooBaa - object data service for hybrid and multi cloud environments :cloud: :wrench:Size: 5.17 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

BlaineEXE/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 58.8 MB - Last synced: 4 days ago - Pushed: 4 days ago

ashishkumsingh/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 99.1 MB - Last synced: about 2 years ago - Pushed: about 2 years ago

koor-tech/rook Fork of rook/rook 📦
Storage Orchestration for KubernetesSize: 58 MB - Last synced: 10 days ago - Pushed: about 1 year ago

msaf1980/graphite-clickhouse Fork of go-graphite/graphite-clickhouse
Graphite cluster backend with ClickHouse supportSize: 34.9 MB - Last synced: 11 months ago - Pushed: 12 months ago


Bughalla/ceph_ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 105 MB - Last synced: about 2 years ago - Pushed: about 2 years ago

rtsp7/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 99.6 MB - Last synced: about 1 year ago - Pushed: about 2 years ago

aruniiird/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 48.2 MB - Last synced: 11 months ago - Pushed: over 2 years ago

Visn0/goChess
Next competitor of chess.comSize: 515 KB - Last synced: about 2 years ago - Pushed: about 2 years ago

go-graphite/carbonapi
Implementation of graphite API (graphite-web) in golangSize: 45 MB - Last synced: 20 days ago - Pushed: 3 months ago

shinemost/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 52.2 MB - Last synced: over 1 year ago - Pushed: over 1 year ago

skjulteskatter/hiddentreasures
HiddenTreasures PlatformSize: 369 KB - Last synced: 11 months ago - Pushed: almost 2 years ago

shanmukhsista/analytix
Real Time Big Data Analytics FrameworkSize: 33.2 KB - Last synced: about 1 year ago - Pushed: over 3 years ago

wb14123/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 47.5 MB - Last synced: about 1 year ago - Pushed: over 1 year ago


edwintrumpet/prueba-tecnica-t-evolvers
Crud para realizar el seguimiento de órdenes de servicioSize: 52.7 KB - Last synced: 11 months ago - Pushed: almost 2 years ago

tengjie5/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 108 MB - Last synced: almost 2 years ago - Pushed: almost 2 years ago

Thorsieger/carbonapi Fork of go-graphite/carbonapi
Implementation of graphite API (graphite-web) in golangSize: 41.6 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

edwintrumpet/prueba-tecnica-boletia
App to know the historical behavior of currenciesSize: 39.1 KB - Last synced: about 1 year ago - Pushed: almost 2 years ago

jouve/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 47.6 MB - Last synced: over 1 year ago - Pushed: over 1 year ago

beardstack/rook Fork of rook/rook
File, Block, and Object Storage Services for your Cloud-Native EnvironmentSize: 44.9 MB - Last synced: about 1 year ago - Pushed: almost 2 years ago

bobtthp/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 105 MB - Last synced: almost 2 years ago - Pushed: about 2 years ago

karthik-us/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 57.6 MB - Last synced: about 1 year ago - Pushed: about 1 year ago

astraw99/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 106 MB - Last synced: over 1 year ago - Pushed: over 1 year ago
