Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CustomStatusCodeMessages = MapStatusCodeMessages{
404: "resource is missing",
401: "authentication failed",
}
CustomStatusCodeMessages is looked up with a status code for custom responses. Add your custom messages here instead of creating if statements in the ionoscloud package
Functions ¶
func SanitizeStatusCode ¶
SanitizeStatusCode calls SanitizeStatusCodeCustom with some default customized messages. Refer to its documentation for behaviour
func SanitizeStatusCodeCustom ¶
func SanitizeStatusCodeCustom(statusCode int, message string, mapOfCustomResponses MapStatusCodeMessages) error
SanitizeStatusCodeCustom is responsible for breaking execution if the response passed as a parameter has a bad status code (i.e. >299). Refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Status for types of HTTP codes. If a custom response is found, but the response code is valid (<300), then we log the response using the validCodeLogFunc param.
func ShortenOpenApiErr ¶
Types ¶
type MapStatusCodeMessages ¶
func (MapStatusCodeMessages) Has ¶
func (m MapStatusCodeMessages) Has(k int) bool
func (MapStatusCodeMessages) Set ¶
func (m MapStatusCodeMessages) Set(k int, v string) MapStatusCodeMessages
Click to show internal directories.
Click to hide internal directories.