Skip to content
Node: http-errorsgithub.com/sahilkhaire/gox/err

Is

Overview ​

Is reports whether err matches target in the error chain.

Part of the err package — Node.js analog: http-errors.

Signature ​

go
func Is(err, target error) bool

Compare: Node.js · Standard Go · gox ​

js
// Typical http-errors pattern in Node.js
go
errors.Is(err, target)
errors.As(err, &target)
fmt.Errorf("context: %w", err)
go
import "github.com/sahilkhaire/gox/err"

if err.Is(err, target) { /* ... */ }

Example ​

go
import "github.com/sahilkhaire/gox/err"

if err.Is(err, target) { /* ... */ }

Tips ​

Import github.com/sahilkhaire/gox/err and call Is directly. See the comparison below for the standard library equivalent.

Standard library alternative ​

Use the standard library directly:

go
errors.Is(err, target)
errors.As(err, &target)
fmt.Errorf("context: %w", err)

← Back to err package overview

MIT Licensed · Built for Node.js developers moving to Go