errors

package
v0.0.0-...-cbea63e Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(rw http.ResponseWriter, err perrors.Error, mimeType string, traceInfo *trace.APITraceInfo)

Write will write out a platform error in a standard way - appropriate for the specified mime type

Types

type ApiError

type ApiError struct {
	ErrorType        string
	ErrorCode        string
	ErrorDescription string
	ErrorContext     []string
	ErrorHttpCode    uint32
	HttpHeaders      map[string]string
	ErrorMultiStack  *stack.Multi
}

ApiError implements the platform Error interface, but provides more support for HTTP-specific stuff

func (*ApiError) AddContext

func (e *ApiError) AddContext(s ...string) perrors.Error

func (*ApiError) Code

func (e *ApiError) Code() string

func (*ApiError) Context

func (e *ApiError) Context() []string

func (*ApiError) Description

func (e *ApiError) Description() string

func (*ApiError) Error

func (e *ApiError) Error() string

func (*ApiError) HttpCode

func (e *ApiError) HttpCode() uint32

func (*ApiError) MultiStack

func (e *ApiError) MultiStack() *stack.Multi

func (*ApiError) Type

func (e *ApiError) Type() string

type ErrorBody

type ErrorBody struct {
	Status     bool     `json:"status"`
	Payload    string   `json:"payload"`
	Number     int      `json:"code"`
	DottedCode string   `json:"dotted_code"`
	Context    []string `json:"context"`
}

Jump to

Keyboard shortcuts

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