func/vendor/github.com/go-errors/errors
knative-automation 6b8cccbbf9
upgrade to latest dependencies (#1269)
bumping github.com/prometheus/common 2af6d03...49b3603:
  > 49b3603 Improve OAuth2 user agent handling (# 391)
  > c5e1b60 config: ignore deprecated warning in tests (# 389)
  > b86ea81 OAuth2: Respect disable keepalives option; Implement close idle connections (# 390)
  > cdc09f0 Merge pull request # 387 from roidelapluie/useragent
  > d75e027 Merge pull request # 388 from simonpasquier/fix-tls-tests-for-go-1.18
  > db0284d Fix comment
  > 26d4974 Add more mimetypes (# 385)
  > aeda642 Update to Go 1.18
  > 2d0de85 Use full roundtripper
  > 627089d Set minimum version for go to 1.16 (# 372)
  > 5ab1c85 config: fix testdata for Go 1.18
  > 316097c Use WithUserAgent
  > 3763a1d TLS config: Enable selection of min TLS version (# 375)
  > 99a1aca add User-Agent header to oauth2 requests
  > 0c7319a Remove comment about PROMETHEUS_COMMON_DISABLE_HTTP2 env var because it is no longer true
  > 840c039 Use path.Clean to clean sigv4 path.
  > ffd0efb Deduplicate slashes for sigv4 signature
  > 902cb39 Merge pull request # 365 from prometheus/superq/bump_sigv4
  > 2c24277 Merge pull request # 362 from prometheus/repo_sync
  > 910a9df Update sigv4 modules
  > f6b0912 Merge pull request # 353 from prometheus/superq/bump_go
  > e457c0a Update common Prometheus files
  > 0e1254b Merge pull request # 359 from prometheus/repo_sync
  > 3c43b4d Update build/test
  > 252ff6f Make HTTP2 user visible
  > 809633a Update common Prometheus files
  > 00591a3 circleci: Test with go 1.17 (# 347)
  > 0762b59 Add proxy_url support for oauth2
  > f57586d circleci: add test-assets and style jobs
  > 1871a70 assets: add file system layer for zipped embed assets
  > ce7006e Update common Prometheus files (# 344)
  > 88ce30c Update common Prometheus files (# 340)
  > 88f1636 Remove github.com/pkg/errors dependency (# 338)
bumping contrib.go.opencensus.io/exporter/prometheus f3a7283...e6b6b80:
  > e6b6b80 Merge pull request # 30 from bogdandrutu/updatedeps
  > aaaf212 Merge pull request # 28 from wincus/update-prometheus
  > 75046ad Upgrade all deps to lastest
  > bf25aba update prometheus golang client
bumping golang.org/x/net 0bcc04d...f2f64eb:
  > f2f64eb http2: Send WindowUpdates when remaining bytes are below a threshold
  > ca03788 dns/dnsmessage: remove unnecessary []byte conversions
  > 0081b4b http2/h2c: propagate HTTP/1 server configuration to HTTP/2
  > f8f703f http2: accept HEAD requests with a body
  > bea034e all: remove redundant type conversion
  > 1e95f45 http/httpproxy: remove comment on https proxy precedance
  > f3363e0 http2: handle server errors after sending GOAWAY
  > 83b083e internal/socket: add missing import to zos-s390x file
  > b0a4917 dns/dnsmessage: use exported MustNewName in example
  > 3211cb9 nettest: fix Unix socket test on macOS
  > 4c34ddd http2: delete multipart form tempfiles after ServeHTTP returns
  > 1d4ff48 http2: add DialTLSContext to Transport
  > 13a9a73 http2: fix conn flow control when stream closes on bad content-length
  > 07c6da5 dns/dnsmessage: add AD and CD bits support
  > f428fae all: add FreeBSD riscv64 support
  > a33c5aa route: import syscall rather than golang.org/x/sys/unix
  > 7431dee lif: import syscall rather than golang.org/x/sys/unix

Signed-off-by: Knative Automation <automation@knative.team>

Signed-off-by: Knative Automation <automation@knative.team>
2022-10-12 05:44:51 +00:00
..
.travis.yml upgrade to latest dependencies (#1269) 2022-10-12 05:44:51 +00:00
LICENSE.MIT Update Knative dependencies to 0.26 (#642) 2021-11-10 08:47:46 -08:00
README.md upgrade to latest dependencies (#1269) 2022-10-12 05:44:51 +00:00
error.go upgrade to latest dependencies (#1269) 2022-10-12 05:44:51 +00:00
error_1_13.go upgrade to latest dependencies (#1269) 2022-10-12 05:44:51 +00:00
error_backward.go upgrade to latest dependencies (#1269) 2022-10-12 05:44:51 +00:00
parse_panic.go Update Knative dependencies to 0.26 (#642) 2021-11-10 08:47:46 -08:00
stackframe.go upgrade to latest dependencies (#1269) 2022-10-12 05:44:51 +00:00

README.md

go-errors/errors

Build Status

Package errors adds stacktrace support to errors in go.

This is particularly useful when you want to understand the state of execution when an error was returned unexpectedly.

It provides the type *Error which implements the standard golang error interface, so you can use this library interchangably with code that is expecting a normal error return.

Usage

Full documentation is available on godoc, but here's a simple example:

package crashy

import "github.com/go-errors/errors"

var Crashed = errors.Errorf("oh dear")

func Crash() error {
    return errors.New(Crashed)
}

This can be called as follows:

package main

import (
    "crashy"
    "fmt"
    "github.com/go-errors/errors"
)

func main() {
    err := crashy.Crash()
    if err != nil {
        if errors.Is(err, crashy.Crashed) {
            fmt.Println(err.(*errors.Error).ErrorStack())
        } else {
            panic(err)
        }
    }
}

Meta-fu

This package was original written to allow reporting to Bugsnag from bugsnag-go, but after I found similar packages by Facebook and Dropbox, it was moved to one canonical location so everyone can benefit.

This package is licensed under the MIT license, see LICENSE.MIT for details.

Changelog

  • v1.1.0 updated to use go1.13's standard-library errors.Is method instead of == in errors.Is
  • v1.2.0 added errors.As from the standard library.
  • v1.3.0 BREAKING updated error methods to return error instead of *Error.

Code that needs access to the underlying *Error can use the new errors.AsError(e)

  // before
  errors.New(err).ErrorStack()
  // after
.  errors.AsError(errors.Wrap(err)).ErrorStack()
  • v1.4.0 BREAKING v1.4.0 reverted all changes from v1.3.0 and is identical to v1.2.0
  • v1.4.1 no code change, but now without an unnecessary cover.out file.
  • v1.4.2 performance improvement to ErrorStack() to avoid unnecessary work https://github.com/go-errors/errors/pull/40