10000 GitHub - decibel/gerrors: Gomega matchers for github.com/pkg/errors
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

decibel/gerrors

 
 

Repository files navigation

Go Report Card

Gomega matchers for wrapped errors

This package provides Gomega matchers to write assertions against errors wrapped using Dave Cheney's github.com/pkg/errors package

MatchWrappedError()

Verifies that an error matches the expected one, including errors that have been wrapped by a context.

This was needed because gomega's default MatchError() fails on wrapped errors

import (
  "errors"
  perrors "github.com/pkg/errors"
  
  . "github.com/chendrix/gerrors"
)

err := errors.New("some error")
err2 := perrors.Wrap(err, "read failed")

Expect(err).To(MatchError("some error")) // Pass
Expect(err2).To(MatchError("some error")) // Fail!

Expect(err).To(MatchWrappedError("some error")) // Pass
Expect(err2).To(MatchWrappedError("some error")) // Pass

About

Gomega matchers for github.com/pkg/errors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%
0