apierror

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Status           ErrorStatus   `json:"status,required"`
	Title            string        `json:"title,required,nullable"`
	Type             ErrorType     `json:"type,required"`
	ValidationErrors []interface{} `json:"validation_errors,required"`
	Detail           string        `json:"detail,nullable"`
	JSON             errorJSON     `json:"-"`
	StatusCode       int
	Request          *http.Request
	Response         *http.Response
}

Error represents an error that originates from the API, i.e. when a request is made and the API returns a response with a HTTP status code. Other errors are not wrapped by this SDK.

func (*Error) DumpRequest

func (r *Error) DumpRequest(body bool) []byte

func (*Error) DumpResponse

func (r *Error) DumpResponse(body bool) []byte

func (*Error) Error

func (r *Error) Error() string

func (*Error) UnmarshalJSON

func (r *Error) UnmarshalJSON(data []byte) (err error)

type ErrorStatus

type ErrorStatus int64
const (
	ErrorStatus500 ErrorStatus = 500
	ErrorStatus429 ErrorStatus = 429
	ErrorStatus413 ErrorStatus = 413
	ErrorStatus409 ErrorStatus = 409
	ErrorStatus404 ErrorStatus = 404
	ErrorStatus400 ErrorStatus = 400
	ErrorStatus401 ErrorStatus = 401
)

func (ErrorStatus) IsKnown added in v0.24.0

func (r ErrorStatus) IsKnown() bool

type ErrorType

type ErrorType string
const (
	ErrorTypeOrbInternalServerError    ErrorType = "https://docs.withorb.com/reference/error-responses#500-internal-server-error"
	ErrorTypeTooManyRequests           ErrorType = "https://docs.withorb.com/reference/error-responses#429-too-many-requests"
	ErrorTypeResourceTooLarge          ErrorType = "https://docs.withorb.com/reference/error-responses#413-resource-too-large"
	ErrorTypeRequestTooLarge           ErrorType = "https://docs.withorb.com/reference/error-responses#413-request-too-large"
	ErrorTypeResourceConflict          ErrorType = "https://docs.withorb.com/reference/error-responses#409-resource-conflict"
	ErrorTypeURLNotFound               ErrorType = "https://docs.withorb.com/reference/error-responses#404-url-not-found"
	ErrorTypeResourceNotFound          ErrorType = "https://docs.withorb.com/reference/error-responses#404-resource-not-found"
	ErrorTypeFeatureNotAvailable       ErrorType = "https://docs.withorb.com/reference/error-responses#404-feature-not-available"
	ErrorTypeOrbAuthenticationError    ErrorType = "https://docs.withorb.com/reference/error-responses#401-authentication-error"
	ErrorTypeRequestValidationError    ErrorType = "https://docs.withorb.com/reference/error-responses#400-request-validation-errors"
	ErrorTypeDuplicateResourceCreation ErrorType = "https://docs.withorb.com/reference/error-responses#400-duplicate-resource-creation"
	ErrorTypeConstraintViolation       ErrorType = "https://docs.withorb.com/reference/error-responses#400-constraint-violation"
)

func (ErrorType) IsKnown added in v0.24.0

func (r ErrorType) IsKnown() bool

Jump to

Keyboard shortcuts

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