Help us shape the future of Go! Take the 2026 Go Developer Survey

apierror

package
v1.321.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const APIVersion = "2.0"

APIVersion is stamped on every error response of a Credimi route group.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Domain  string `json:"domain"`
	Reason  string `json:"reason"`
	Message string `json:"message"`
}

APIError is the error returned by handlers of Credimi route groups. ErrorHandlingMiddleware renders it as the "error" object of a Response.

func New

func New(code int, domain, reason, message string) *APIError

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface.

func (*APIError) Response

func (e *APIError) Response() Response

Response wraps the error in the response envelope, using its message as the top-level message.

type Response

type Response struct {
	APIVersion string    `json:"apiVersion"`
	Message    string    `json:"message"`
	Error      *APIError `json:"error"`
}

Response is the JSON body of every error answered by a Credimi route group.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL