errors

package module
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 8 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.

Creating tags:

vscode:
1) choose source control on activity bar
2) commit all changes that were done
3) choose tab tags and press the plus button
4) when the tag is created, run command pallete and choose 'Git: Push (Follow Tags)'

git:
1) commit all changes
2) exec cmd in the terminal or shell git tag -a v1.4 -m 'my version 1.4'
3) git push origin --tags

github:
1) choose Code tab
2) on the right side choose Releases
3) choose Draft new release
4) follow the instruction

Documentation

Index

Constants

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

Types of instances

View Source
const (
	AlreadyExists           = "Already exists!"
	OffersEnded             = "Offers ended today!"
	ImageNotDeleted         = "Image cannot be deleted!"
	ImageNotUploaded        = "Image cannot be uploaded!"
	BadRequest              = "Bad request!"
	CharterHasListings      = "Charter cannot be deleted!"
	CharterNotCreated       = "Charter not created!"
	FileExistsAlready       = "File exists already!"
	InactiveListing         = "Inactive Listing!"
	InvalidMsgFormat        = "Invalid message format!"
	InvalidBodyParam        = "Invalid body parameter!"
	InvalidDates            = "Invalid dates!"
	InvalidHeaderParam      = "Invalid header parameter!"
	InvalidOwnerListing     = "Invalid owner listing!"
	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!"
	ForbiddenUpload   = "Forbidden upload!"
)

List of 403 errors

View Source
const (
	CharterNotFound     = "Charter not found!"
	ListingNotFound     = "Listing not found!"
	LocationNotFound    = "Location not found!"
	ReservationNotFound = "Reservation 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 NewImageSizeError added in v1.0.5

func NewImageSizeError(size int64) *models.InvalidParam

func NewImageSizePxError added in v1.0.5

func NewImageSizePxError(name string, px int) *models.InvalidParam

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