response

package
v0.0.0-...-720b936 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(err error) bool

IsError checks if an error of type Error exists.

func NewError

func NewError(err error, status int) error

NewError wraps a provided error with an HTTP status code. This function should be used when handlers encounter expected errors.

Types

type Error

type Error struct {
	Err    error
	Status int
}

Error is used to pass an error during the request through the application with web specific context.

func GetError

func GetError(err error) *Error

GetError returns a copy of the Error pointer.

func (*Error) Error

func (re *Error) Error() string

Error implements the error interface. It uses the default message of the wrapped error. This is what will be shown in the services' logs.

type ErrorDocument

type ErrorDocument struct {
	Error  string            `json:"error"`
	Fields map[string]string `json:"fields,omitempty"`
}

Jump to

Keyboard shortcuts

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