Help us shape the future of Go! Take the 2026 Go Developer Survey

oapierror

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 3 Imported by: 183

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// When a response has a bad status, this limits the number of characters that are shown from the response Body
	ApiErrorMaxCharacterLimit = 500
)

Functions

func FormatErrorMessage

func FormatErrorMessage(status string, v interface{}) string

Format errorMessage message using title and detail when Model implements rfc7807

Types

type GenericOpenAPIError

type GenericOpenAPIError struct {
	StatusCode   int
	Body         []byte
	ErrorMessage string
	Model        interface{}
}

GenericOpenAPIError Provides access to the Body, errorMessage and Model on returned Errors.

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an errorMessage.

func (GenericOpenAPIError) GetBody

func (e GenericOpenAPIError) GetBody() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) GetModel

func (e GenericOpenAPIError) GetModel() interface{}

Model returns the unpacked Model of the errorMessage

func (GenericOpenAPIError) GetStatusCode

func (e GenericOpenAPIError) GetStatusCode() int

StatusCode returns the status code of the response

Jump to

Keyboard shortcuts

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