apierror

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 5 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"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses429TooManyRequests           ErrorType = "https://docs.withorb.com/reference/error-responses#429-too-many-requests"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses413ResourceTooLarge          ErrorType = "https://docs.withorb.com/reference/error-responses#413-resource-too-large"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses413RequestTooLarge           ErrorType = "https://docs.withorb.com/reference/error-responses#413-request-too-large"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses409ResourceConflict          ErrorType = "https://docs.withorb.com/reference/error-responses#409-resource-conflict"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses404URLNotFound               ErrorType = "https://docs.withorb.com/reference/error-responses#404-url-not-found"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses404ResourceNotFound          ErrorType = "https://docs.withorb.com/reference/error-responses#404-resource-not-found"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses404FeatureNotAvailable       ErrorType = "https://docs.withorb.com/reference/error-responses#404-feature-not-available"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses401AuthenticationError       ErrorType = "https://docs.withorb.com/reference/error-responses#401-authentication-error"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses400RequestValidationErrors   ErrorType = "https://docs.withorb.com/reference/error-responses#400-request-validation-errors"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses400DuplicateResourceCreation ErrorType = "https://docs.withorb.com/reference/error-responses#400-duplicate-resource-creation"
	ErrorTypeHTTPSDocsWithorbComReferenceErrorResponses400ConstraintViolation       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