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

AppError

Overview

AppError is an error with an HTTP status code.

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

AppError is a type exported by gox. Methods on this type are documented separately.

Signature

go
type AppError struct {
	Code    int
	Message string
	Cause   error
}

Compare: Node.js · Standard Go · gox

js
// Typical http-errors pattern in Node.js
go
// Use the underlying stdlib or driver directly.
// See package overview for escape hatches.
go
import "github.com/sahilkhaire/gox/err"

base := errors.New("root")
e := Wrap(http.StatusTeapot, "wrapped", base)
var ae *AppError

Example

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

base := errors.New("root")
e := Wrap(http.StatusTeapot, "wrapped", base)
var ae *AppError

Tips

Browse methods on this type in the sidebar for handler-style APIs and options structs.

Standard library alternative

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

Back to err package overview

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