From e417fd54708d08d612e9c1ca5d27947e2523cab4 Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Thu, 26 Sep 2024 13:49:31 +0200 Subject: [PATCH] fix(api): bad error message --- testing/api/matchers.go | 3 +++ 1 file changed, 3 insertions(+) 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) }