errors

package
v0.0.0-...-a91455d Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Unknown error code
	ErrUnknown = 0
	// HTTP method not allowed
	ErrMethodNotAllowed = 1
	// No authorization header was found in request
	ErrNoAuthHdr = 2
	// Failed reading the HTTP request body
	ErrReadingReqBody = 3
	// HTTP request body was empty but should not have been
	ErrEmptyReqBody = 4
	// HTTP request body was of the wrong format
	ErrBadReqBody = 5
	// Authorization failure
	ErrAuthenticationFailure = 20
	// No username and password were in the authorization header
	ErrNoUserPass = 21
	// Enrollment is currently disabled for the server
	ErrEnrollDisabled = 22
	// Invalid user name
	ErrInvalidUser = 23
	// Invalid password
	ErrInvalidPass = 24
	// Bad certificate signing request
	ErrBadCSR = 31
	// Error connecting to database
	ErrConnectingDB = 51
	// Error occured when making a Get request to database
	ErrDBGet = 63
	// Error occured while deleting user
	ErrDBDeleteUser = 65
	// Incorrect password limit reached
	ErrPasswordAttempts = 73
)

Error codes

Functions

func IsFatalError

func IsFatalError(err error) bool

IsFatalError return true if the error is of type 'FatalErr'

func NewAuthenticationErr

func NewAuthenticationErr(code int, format string, args ...interface{}) error

NewAuthenticationErr constructs an HTTP error specifically indicating an authentication failure.

func NewHTTPErr

func NewHTTPErr(scode, code int, format string, args ...interface{}) error

NewHTTPErr constructs a new HTTP error wrappered with pkg/errors error.

Types

type FatalErr

type FatalErr struct {
	ServerErr
}

FatalErr is a server error that is will prevent the server/CA from continuing to operate

func NewFatalError

func NewFatalError(code int, format string, args ...interface{}) *FatalErr

NewFatalError constructs a fatal error

func (*FatalErr) Error

func (fe *FatalErr) Error() string

func (*FatalErr) String

func (fe *FatalErr) String() string

type HTTPErr

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

HTTPErr is an HTTP error.

func CreateHTTPErr

func CreateHTTPErr(scode, code int, format string, args ...interface{}) *HTTPErr

CreateHTTPErr constructs a new HTTP error.

func (*HTTPErr) Error

func (he *HTTPErr) Error() string

Error returns the string representation

func (*HTTPErr) GetLocalCode

func (he *HTTPErr) GetLocalCode() int

GetLocalCode returns the local error code

func (*HTTPErr) GetLocalMsg

func (he *HTTPErr) GetLocalMsg() string

GetLocalMsg returns the local error message

func (*HTTPErr) GetRemoteCode

func (he *HTTPErr) GetRemoteCode() int

GetRemoteCode returns the remote error code

func (*HTTPErr) GetRemoteMsg

func (he *HTTPErr) GetRemoteMsg() string

GetRemoteMsg returns the remote error message

func (*HTTPErr) GetStatusCode

func (he *HTTPErr) GetStatusCode() int

GetStatusCode returns the HTTP status code

func (*HTTPErr) Remote

func (he *HTTPErr) Remote(code int, format string, args ...interface{}) *HTTPErr

Remote sets the remote code and message to something different from that of the local code and message

func (*HTTPErr) String

func (he *HTTPErr) String() string

String returns a string representation of this augmented error

type ServerErr

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

ServerErr contains error message with corresponding CA error code

func NewServerError

func NewServerError(code int, format string, args ...interface{}) *ServerErr

NewServerError constructs a server error

Jump to

Keyboard shortcuts

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