usererror

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorBuilder

type ErrorBuilder struct {
	// contains filtered or unexported fields
}

ErrorBuilder builds an error from the fields in a string map

func BuildError

func BuildError(fields Fields) *ErrorBuilder

BuildError builds an error from the fields in a string map

func (*ErrorBuilder) CreateError

func (eb *ErrorBuilder) CreateError(code int, message string) JSONableError

CreateError builds an error from a HTTP-style error code, a message string, and the fields map

type Fields

type Fields map[string]interface{}

Fields is a string map holding information about an error

type JSONableError

type JSONableError interface {
	error
	JSON() map[string]interface{}
}

JSONableError is a JSON-compatible error

func CreateError

func CreateError(code int, message string) JSONableError

CreateError builds an error from a HTTP-style error code and a message string

type UserError

type UserError struct {
	Code    int
	Message string
	Fields  map[string]interface{}
}

UserError is an error we present to an end user

func (*UserError) Error

func (ue *UserError) Error() string

func (*UserError) JSON

func (ue *UserError) JSON() map[string]interface{}

JSON returns the UserError as a JSON-compatible map

Jump to

Keyboard shortcuts

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