errorreport

package
v0.0.0-...-acbe8ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errorreport centralizes "which Sentry hub does this code path report on?" so handlers, middleware and background workers can never drift apart.

Two rules, deliberately different:

  • HTTP request paths report on the request-scoped hub only. SentryMiddleware puts one on every request context, so a missing hub means "not an HTTP request" (a unit test, a non-HTTP caller) and reporting is a no-op rather than a surprise event on the process-wide hub.
  • Background workers have no middleware, so they fall back to sentry.CurrentHub() — which is the hub sentry.Init configured, or an unbound no-op hub when no DSN was set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOnRequest

func CaptureOnRequest(r *http.Request, err error)

CaptureOnRequest reports err on the request-scoped Sentry hub. It is a no-op when the request or the hub is absent, so non-HTTP callers stay silent.

func CaptureWithTags

func CaptureWithTags(ctx context.Context, err error, tags map[string]string)

CaptureWithTags reports err with the given tags, on the context hub when one is present and on the current (process-wide) hub otherwise. Tags with an empty value are skipped so an absent field never becomes a "" facet in the Sentry UI.

Types

This section is empty.

Directories

Path Synopsis
Package errorreporttest provides a capturing Sentry transport for tests.
Package errorreporttest provides a capturing Sentry transport for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL