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.jsgo
// 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 *AppErrorExample
go
import "github.com/sahilkhaire/gox/err"
base := errors.New("root")
e := Wrap(http.StatusTeapot, "wrapped", base)
var ae *AppErrorTips
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.