File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,12 @@ type LabeledError interface {
334334 HasErrorLabel (string ) bool
335335}
336336
337+ type errorCoder interface {
338+ ErrorCodes () []int
339+ }
340+
341+ var _ errorCoder = ServerError (nil )
342+
337343// ServerError is the interface implemented by errors returned from the server. Custom implementations of this
338344// interface should not be used in production.
339345type ServerError interface {
@@ -910,7 +916,7 @@ func ErrorCodes(err error) []int {
910916 return nil
911917 }
912918
913- var ec interface { ErrorCodes () [] int }
919+ var ec errorCoder
914920 if errors .As (wrapErrors (err ), & ec ) {
915921 return ec .ErrorCodes ()
916922 }
Original file line number Diff line number Diff line change @@ -761,7 +761,7 @@ func (n netErr) Temporary() bool {
761761
762762var _ net.Error = (* netErr )(nil )
763763
764- func TestErrorCodesFrom (t * testing.T ) {
764+ func TestErrorCodes (t * testing.T ) {
765765 tests := []struct {
766766 name string
767767 input error
You can’t perform that action at this time.
0 commit comments