apierror

package
v1.334.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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