errors

package module
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 8 Imported by: 1

README

Ahoylog errors package

Ahoylog package used together with go-swagger to produce standardized set of errors as ProblemDetails.

List of errors

HTTP 400
Title Detail Status Code Instance
AlreadyExists The requested resource already exists! 400 badRequest client
BadRequest There was a problem with the request! 400 badRequest client
CharterHasListings Charter cannot be deleted, because it still has some active listings! 400 badRequest client
CharterNotCreated There was a problem to create charter profile! 400 badRequest client
FileExistsAlready The requested resource already exists! 400 badRequest client
FileNotCreated There was a problem to create file! 400 badRequest export
InvalidBodyParam The HTTP request contains an unsupported body parameter! 400 badRequest client
InvalidDates The requested dates are invalid! 400 badRequest client
InvalidHeaderParam The HTTP request contains an unsupported header parameter! 400 badRequest client
InvalidMsgFormat The HTTP request has an invalid format! 400 badRequest client
ImageInvalid File must be a valid image - image/jpeg, image/jpg, image/png! 400 badRequest client
ImageNotDeleted There was a problem to delete image! 400 badRequest image
ImageNotUploaded There was a problem to upload image! 400 badRequest image
InactiveListing Listing %v is not in the active state! 400 badRequest client
InvalidOwnerListing Charter doesn't own the listing %v! 400 badRequest client
InvalidQueryParam The HTTP request contains an unsupported query parameter in the URI! 400 badRequest client
InvalidPathParam The HTTP request contains an unsupported path parameter in the URI! 400 badRequest client
ListingNotCreated There was a problem to create listing! 400 badRequest client
LocationNotCreated There was a problem to create location! 400 badRequest client
MandatoryParamIncorrect Mandatory parameter has semantically incorrect value! 400 badRequest client
MandatoryParamMissing Parameter which is defined as mandatory is missing! 400 badRequest client
NameAlreadyTaken Requested name is already taken! Please, specify another name. 400 badRequest client
OffersEnded Available number of the offers ended for today! 400 badRequest client
OffersMaxListings Maximum limit of %v listings is reached. Please, reduce number of listings in offer! 400 badRequest client
PortAlreadyExists Requested port/marina name already exists for this country and city! 400 badRequest client
ReservationNotCreated There was a problem to create reservation! 400 badRequest client
HTTP 401
Title Detail Status Code Instance
InvalidAuthToken Authorization token is invalid! 401 unauthorized client
MissingAuthToken Authorization token is missing! 401 unauthorized client
UnauthorizedAccess The request doesn't have permissions to access resources! 401 unauthorized api
HTTP 403
Title Detail Status Code Instance
ForbiddenAction You don't have a permission to make this action! 403 forbidden client
ForbiddenResource You don't have a permission to access this resource! 403 forbidden client
ForbiddenUpload This accound doesn't have permission to upload images! 403 forbidden client
HTTP 404
Title Detail Status Code Instance
CharterNotFound The charter indicated in the request does not exist! 404 notFound client
ListingNotFound The listing indicated in the request does not exist! 404 notFound client
LocationNotFound The location indicated in the request does not exist! 404 notFound client
ReservationNotFound Requested reservation does not exist! 404 notFound client
ResourceNotFound Requested resource does not exist! 404 notFound client
UserNotFound The user indicated in the request does not exist! 404 notFound client
UsersNotFound Requested users does not exist! 404 notFound client
HTTP 405
Title Detail Status Code Instance
MethodNotAllowed Requested method is not allowed. Check the response header Allow for allowed methods! 405 methodNotAllowed client
HTTP 429
Title Detail Status Code Instance
CongestionRisk The request is rejected due to excessive traffic. If continued over time, may lead to an overload situation. 429 tooManyRequests client
HTTP 500
Title Detail Status Code Instance
UnspecifiedFailure The request is rejected due to unspecified reason at the system! 500 internalServerError api
SystemFailure We are sorry, but there is an internal problem with the application! 500 internalServerError api
HTTP 503
Title Detail Status Code Instance
ServiceUnavailable The service experiences congestion and performs overload control. It does not allow the request to be processed. 503 serviceUnavailable api
HTTP 504
Title Detail Status Code Instance
GatewayTimeout The request is rejected due a request that has timed out at the HTTP client. 504 gatewayTimeout api

Documentation

Index

Constants

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

Types of instances

View Source
const (
	AlreadyExists           = "Already exists!"
	OffersEnded             = "Offers ended today!"
	OffersMaxListings       = "Maximum listings reached!"
	ImageInvalid            = "File is not a valid image!"
	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!"
	FileNotCreated          = "File not created!"
	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 (
	CongestionRisk = "Too many requests!"
)

list of 429 errors

View Source
const (
	GatewayTimeout = "Gateway Timeout!"
)

List of 504 errors

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

list of 405 errors

View Source
const (
	ServiceUnavailable = "Service Unavailable!"
)

List of 503 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