errs

package
v0.19.770 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DSN for the "main" sentry project. Everything goes in the same project, until we have a good reason to deviate.
	SentryMainDSN string = "https://a0546c06ff00cb18c7867c5783f96763@o4507623795523584.ingest.us.sentry.io/4507623799193600"
)

Variables

This section is empty.

Functions

func HasNuonStackTrace

func HasNuonStackTrace(err error) bool

HasNuonStackTrace reports whether the provided error contains at least one stack trace that originated in Nuon code.

func NewUserFacing

func NewUserFacing(format string, args ...any) error

NewUserFacing creates a new error with a message intended for direct consumption by an end user.

This is the equivalent of WithUserFacing, but for use when there's no underlying error to be wrapped.

func ReportToSentry

func ReportToSentry(err error, opt *SentryErrOptions) string

ReportToSentry reports an error to sentry, populating the data in a standardized manner for all Nuon errors.

func WithUserFacing

func WithUserFacing(err error, format string, args ...any) error

WithUserFacing wraps another error with a message intended for direct consumption by an end user.

Use this function when there is exactly one known user who will consume the message. For example:

  • DO use this in a CLI command where it's known that a CLI user will see the message
  • DO NOT use this on the server side of ctl-api, where the caller may be CLI or terraform

This function will also ensure a stack trace is collected. Stack traces are emitted to sentry, but never shown to end users.

If there is no underlying error to be wrapped, use NewUserFacing instead.

Types

type SentryErrOptions

type SentryErrOptions struct {
	Tags   map[string]string
	UserID string
}

SentryErrOption is a functional option type for passing additional options to a SentryErr.

type SentryTagger

type SentryTagger interface {
	error
	ErrorTags() map[string]string
}

An SentryTagger is an error that additionally returns a set of k/v pairs to be emitted with Snetry events.

If multiple errors in the causal chain emit tags, the tag emitted by the error highest in the chain will be used.

Jump to

Keyboard shortcuts

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