You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Andrey Kovalev 7fe2f59f05
go mod tidy && go mod vendor
3 years ago
..
.codecov.yml go mod tidy && go mod vendor 3 years ago
.editorconfig go mod tidy && go mod vendor 3 years ago
.gitignore go mod tidy && go mod vendor 3 years ago
.golangci.yml go mod tidy && go mod vendor 3 years ago
LICENSE go mod tidy && go mod vendor 3 years ago
Makefile go mod tidy && go mod vendor 3 years ago
PATENTS go mod tidy && go mod vendor 3 years ago
README.md go mod tidy && go mod vendor 3 years ago
adaptor.go go mod tidy && go mod vendor 3 years ago
doc.go go mod tidy && go mod vendor 3 years ago
errors.go go mod tidy && go mod vendor 3 years ago
format.go go mod tidy && go mod vendor 3 years ago
frame.go go mod tidy && go mod vendor 3 years ago
go.coverage.sh go mod tidy && go mod vendor 3 years ago
go.test.sh go mod tidy && go mod vendor 3 years ago
noerrtrace.go go mod tidy && go mod vendor 3 years ago
trace.go go mod tidy && go mod vendor 3 years ago
wrap.go go mod tidy && go mod vendor 3 years ago

README.md

errors Go Reference codecov

Fork of xerrors with explicit Wrap instead of %w.

Clear is better than clever.

go get github.com/go-faster/errors
if err != nil {
	return errors.Wrap(err, "something went wrong")
}

Why

  • Using Wrap is the most explicit way to wrap errors
  • Wrapping with fmt.Errorf("foo: %w", err) is implicit, redundant and error-prone
  • Parsing "foo: %w" is implicit, redundant and slow
  • The pkg/errors and xerrrors are not maintainted
  • The cockroachdb/errors is too big
  • The errors has no caller stack trace

Don't need traces?

Call errors.DisableTrace or use build tag noerrtrace.

Migration

go get github.com/go-faster/errors/cmd/gowrapper@latest
gowrapper ./...

License

BSD-3-Clause, same as Go sources