diff --git a/testing/api/matchers.go b/testing/api/matchers.go index de12fe91..1aac06e8 100644 --- a/testing/api/matchers.go +++ b/testing/api/matchers.go @@ -29,6 +29,9 @@ func (s *HaveErrorCodeMatcher) Match(actual interface{}) (success bool, err erro } func (s *HaveErrorCodeMatcher) FailureMessage(actual interface{}) (message string) { + if actual == nil { + return fmt.Sprintf("error should have code %s but is nil", s.expected) + } return fmt.Sprintf("error should have code %s but have %s", s.expected, s.lastSeen) }