responses

package
v0.0.0-...-d26b62e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(rw http.ResponseWriter, err string, code int)

Error is a simplified JSONError wrapper that accepts a string error

func JSONError

func JSONError(w http.ResponseWriter, err interface{}, code int)

JSONError writes the given object as an error with the given code to the response writer

func Unauthorized

func Unauthorized(rw http.ResponseWriter)

Unauthorized writes a unauthorized JSONError to the response writer

Types

type ErrorResponse

type ErrorResponse struct {
	// The error
	Error string `json:"error"`
}

ErrorResponse is a generic response containing an error

type ValidationError

type ValidationError struct {
	// The missing requirements
	Errors interface{} `json:"validationErrors"`
}

ValidationError shows the failed validation requirements. Each form property that has missing requirements is listet under Errors (validationErrors)

func (*ValidationError) Error

func (myErr *ValidationError) Error() string

Jump to

Keyboard shortcuts

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