Skip to content
Node: http-errors10 APIs

err

Package err provides application errors with HTTP status codes (Express-style).

import "github.com/sahilkhaire/gox/err"
## API reference

Select a symbol below — each page explains what it does, shows Node.js vs Go comparisons, and includes a runnable example.

Functions

SymbolNode.jsKindSummary
AsfuncAs finds the first error in the chain assignable to target.
IsfuncIs reports whether err matches target in the error chain.

Types

SymbolNode.jsKindSummary
AppErrortypeAppError is an error with an HTTP status code.

Methods

SymbolNode.jsKindSummary
AppError.BadRequestcreateError(400, msg)methodBadRequest returns a 400 AppError.
AppError.ForbiddencreateError(403, msg)methodForbidden returns a 403 AppError.
AppError.InternalcreateError(500, msg)methodInternal returns a 500 AppError.
AppError.NewmethodNew creates an AppError with code and message.
AppError.NotFoundcreateError(404, msg)methodNotFound returns a 404 AppError.
AppError.UnauthorizedcreateError(401, msg)methodUnauthorized returns a 401 AppError.
AppError.WrapmethodWrap wraps cause with code and message.

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