errors

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: MIT Imports: 6 Imported by: 1

README

Kviky package used together with go-swagger to produce standardized set of errors in ProblemDetails https://tools.ietf.org/html/rfc7807 format.

Documentation

Index

Constants

View Source
const (
	InstApp      = "app"
	InstApi      = "api"
	InstIdentity = "identity"
	InstClient   = "client"
	InstDB       = "database"
)

Types of instances

View Source
const (
	CharterHasListings      = "Charter cannot be deleted!"
	CharterNotCreated       = "Charter not created!"
	InvalidMsgFormat        = "Invalid message format!"
	InvalidBodyParam        = "Invalid body parameter!"
	InvalidHeaderParam      = "Invalid header parameter!"
	InvalidQueryParam       = "Invalid query parameter!"
	InvalidPathParam        = "Invalid path parameter!"
	ListingNotCreated       = "Listing not created!"
	LocationNotCreated      = "Location not created!"
	MandatoryParamIncorrect = "Mandatory parameter incorrect!"
	MandatoryParamMissing   = "Mandatory parameter missing!"
	NameAlreadyTaken        = "Name is already taken!"
	PortAlreadyExists       = "Port name exists already!"
	ReservationNotCreated   = "Reservation not created!"
)

List of 400 errors

View Source
const (
	InvalidAuthToken   = "Invalid authorization token!"
	MissingAuthToken   = "Missing authorization token!"
	UnauthorizedAccess = "Unauthorized access!"
)

List of 401 errors

View Source
const (
	ForbiddenAction   = "Forbidden action!"
	ForbiddenResource = "Forbidden resource!"
)

List of 403 errors

View Source
const (
	CharterNotFound  = "Charter not found!"
	ListingNotFound  = "Listing not found!"
	LocationNotFound = "Location not found!"
	ResourceNotFound = "Resource not found!"
	UserNotFound     = "User not found!"
	UsersNotFound    = "Users not found!"
)

list of 404 errors

View Source
const (
	SystemFailure      = "System failure!"
	UnspecifiedFailure = "Unspecified failure!"
)

List of 500 errors

View Source
const (
	MethodNotAllowed = "Method not allowed!"
)

list of 405 errors

Variables

This section is empty.

Functions

func CreateProblemDetails

func CreateProblemDetails(errorName string) *models.ProblemDetails

CreateProblemDetails - Helper function to create ProblemDetails object

func NewInvalidParam

func NewInvalidParam(name string) *models.InvalidParam

func NewMissingParam

func NewMissingParam(name string) *models.InvalidParam

func ServeError

func ServeError(rw http.ResponseWriter, r *http.Request, err error)

ServeError the error handler interface implementation

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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