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
3bl3gamer/tgclient
Telegram (mtproto) client written in golangSize: 1.64 MB - Last synced: 4 months ago - Pushed: 4 months ago

go-graphite/graphite-clickhouse
Graphite cluster backend with ClickHouse supportSize: 40 MB - Last synced: 22 days ago - Pushed: about 1 month ago

kgoins/ldifparser
An LDIF reader/writerSize: 1020 KB - Last synced: 11 months ago - Pushed: over 2 years ago

skbkontur/carbonapi Fork of go-graphite/carbonapi
API server for github.com/go-graphite/carbonzipperSize: 44.3 MB - Last synced: 4 months ago - Pushed: 4 months ago

3bl3gamer/tg_history_dumper
Exports messages and media from Telegram dialogs, groups and channelsSize: 152 KB - Last synced: 4 months ago - Pushed: 4 months ago

ansel1/merry
Golang errors with stacktrace and contextSize: 334 KB - Last synced: 1 day ago - Pushed: 15 days ago

ThalesGroup/kmip-go
KMIP client library in GolangSize: 535 KB - Last synced: 16 days ago - Pushed: over 1 year ago

bcc-code/aurora 📦
[BCC.Media] The system powering bcc.onlineSize: 20.4 MB - Last synced: about 1 year ago - Pushed: about 2 years ago

NeatNerdPrime/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 54.5 MB - Last synced: 3 months ago - Pushed: 3 months ago

3bl3gamer/storjnet-info
Storj v3 network statisticsSize: 1000 KB - Last synced: about 1 month ago - Pushed: about 1 month ago

bcc-code/bcc-media-platform
[BCC Media] Website and backend for the BCC Media appsSize: 24.2 MB - Last synced: 3 days ago - Pushed: 3 days ago

PhoenixRedflash/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 127 MB - Last synced: 5 days ago - Pushed: 5 days ago

Rakshith-R/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 153 MB - Last synced: 24 days ago - Pushed: 24 days ago



joseesco24/sudoku_solver 📦
This repository contains a small sudoku solver API that uses four different solving methods and is based on Docker containerized microservices.Size: 2.31 MB - Last synced: about 2 years ago - Pushed: over 2 years ago

bcc-code/mediabank-bridge
Grpc bridge to various mediabank related systemsSize: 75.2 KB - Last synced: 11 months ago - Pushed: about 2 years ago



ChaunceyShannon/golanglibs
Some Golang FunctionSize: 782 KB - Last synced: 11 months ago - Pushed: almost 3 years ago

weirdwiz/noobaa-operator Fork of noobaa/noobaa-operator
Operator for NooBaa - object data service for hybrid and multi cloud environments :cloud: :wrench:Size: 3.28 MB - Last synced: about 2 years ago - Pushed: over 2 years ago



patrizok/tg-history-dumper Fork of 3bl3gamer/tg_history_dumper
Exports messages and media from Telegram dialogs, groups and channelsSize: 133 KB - Last synced: 11 months ago - Pushed: 11 months ago

datenshicommunity/hanayo
hanayo - main repository frontendSize: 25.4 MB - Last synced: over 1 year ago - Pushed: almost 2 years ago


3bl3gamer/receipt_qr_scanner
Сканирует QR-коды с чеков (браузером), скачивает данные чеков с ФНС (сервером)Size: 690 KB - Last synced: 12 days ago - Pushed: 12 days ago

screwyprof/skeleton
Golang Application SkeletonSize: 8.24 MB - Last synced: about 1 month ago - Pushed: over 2 years ago

yati1998/ceph-csi Fork of ceph/ceph-csi
CSI driver for cephSize: 119 MB - Last synced: 3 months ago - Pushed: 3 months ago

halilagin/on-prem-or-cloud-agnostic-kubernetes
on-prem-or-cloud-agnostic-kubernetesSize: 2.7 MB - Last synced: about 2 years ago - Pushed: over 2 years ago


neumantm/logtrace
Logrus hook for attaching an error traceback to a log entrySize: 21.5 KB - Last synced: about 1 month ago - Pushed: about 1 year ago

red-hat-storage/ceph-csi Fork of ceph/ceph-csi
CSI driver for CephSize: 128 MB - Last synced: 8 days ago - Pushed: 8 days ago

ventcon/ventcon-hwio
The hardware interface for the ventcon projectSize: 54.7 KB - Last synced: 29 days ago - Pushed: 29 days ago

jhoblitt/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 59.3 MB - Last synced: 8 days ago - Pushed: 17 days ago

Lykos153/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 59.8 MB - Last synced: 8 days ago - Pushed: 5 months ago

chbuescher/carbonapi Fork of go-graphite/carbonapi
Implementation of graphite API (graphite-web) in golangSize: 41.7 MB - Last synced: about 2 years ago - Pushed: over 2 years ago


criteo-forks/rook Fork of rook/rook
Storage Orchestration for KubernetesSize: 55.1 MB - Last synced: about 2 months ago - Pushed: about 2 months ago

msaf1980/carbonapi Fork of go-graphite/carbonapi
API server for github.com/go-graphite/carbonzipperSize: 44.4 MB - Last synced: 11 months ago - Pushed: 11 months ago

PaaS-TA/paas-ta-container-platform-deployment
paas-ta-container-platform-deploymentSize: 269 MB - Last synced: almost 2 years ago - Pushed: almost 2 years ago

grafana/carbonapi Fork of go-graphite/carbonapi
Implementation of graphite API (graphite-web) in golangSize: 44.4 MB - Last synced: 15 days ago - Pushed: 9 months ago
