apierrors

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InternalAPIError APIError = APIError{
		Message: "Internal Server Error",
		Code:    "internal_error",
	}
	MissingFieldError FieldErrors = FieldErrors{
		APIError{
			Message: "This field is required.",
			Code:    "required",
		}}
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string `json:"message"`
	Code    string `json:"code"`
}

type FieldErrors

type FieldErrors []APIError

func SingleFieldError

func SingleFieldError(message, code string) FieldErrors

type RequestError

type RequestError struct {
	Message string                 `json:"message"`
	Code    string                 `json:"status"`
	Errors  map[string]FieldErrors `json:"errors,omitempty"`
}

RequestError is returned when the API has errors not associated with the request content

Jump to

Keyboard shortcuts

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