mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Renaming IsErr to ErrorIs
Signed-off-by: Matthias Hanel <mh@synadia.com>
This commit is contained in:
@@ -261,7 +261,7 @@ func errorsUnwrap(err error) error {
|
||||
|
||||
// implements: go 1.13 errors.Is(err, target error) bool
|
||||
// TODO replace with native code once we no longer support go1.12
|
||||
func IsErr(err, target error) bool {
|
||||
func ErrorIs(err, target error) bool {
|
||||
// this is an outright copy of go 1.13 errors.Is(err, target error) bool
|
||||
// removed isComparable
|
||||
if err == nil || target == nil {
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestErrCtx(t *testing.T) {
|
||||
if e == ErrWrongGateway {
|
||||
t.Fatalf("%v and %v can't be compared this way", e, ErrWrongGateway)
|
||||
}
|
||||
if !IsErr(e, ErrWrongGateway) {
|
||||
if !ErrorIs(e, ErrWrongGateway) {
|
||||
t.Fatalf("%s and %s ", e, ErrWrongGateway)
|
||||
}
|
||||
if UnpackIfErrorCtx(ErrWrongGateway) != ErrWrongGateway.Error() {
|
||||
@@ -55,7 +55,7 @@ func TestErrCtxWrapped(t *testing.T) {
|
||||
if e == ErrWrongGateway {
|
||||
t.Fatalf("%v and %v can't be compared this way", e, ErrWrongGateway)
|
||||
}
|
||||
if !IsErr(e, ErrWrongGateway) {
|
||||
if !ErrorIs(e, ErrWrongGateway) {
|
||||
t.Fatalf("%s and %s ", e, ErrWrongGateway)
|
||||
}
|
||||
if UnpackIfErrorCtx(ErrWrongGateway) != ErrWrongGateway.Error() {
|
||||
|
||||
@@ -582,7 +582,7 @@ func TestMaxControlLine(t *testing.T) {
|
||||
|
||||
pub := []byte("PUB foo.bar 11\r")
|
||||
err := c.parse(pub)
|
||||
if !IsErr(err, ErrMaxControlLine) {
|
||||
if !ErrorIs(err, ErrMaxControlLine) {
|
||||
t.Fatalf("Expected an error parsing longer than expected control line")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user