errors

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target interface{}) bool

As calls stdlib errors.As.

func Is

func Is(err, target error) bool

Is calls stdlib errors.Is.

func Unwrap

func Unwrap(err error) error

Unwrap calls stdlib errors.Unwrap.

Types

type Error

type Error = errors.ErrorBase[Status]

type Status

type Status uint64

Status is a request status code.

const BadPassword Status = 403

BadPassword is returned when an incorrect decryption password.

const BadRequest Status = 400

BadRequest is returned when the request was invalid.

const Conflict Status = 409

Conflict is returned when the request failed due to a conflict.

const EncodingError Status = 502

EncodingError is returned when encoding or decoding failed.

const InternalError Status = 500

InternalError is returned when an internal error occurred.

const NoPassword Status = 401

NoPassword is returned when an encryption password is required.

const NotFound Status = 404

NotFound is returned when a record could not be found.

const NotSupported Status = 405

NotSupported is returned when a feature is used in a way that is not supported.

const OK Status = 200

OK is returned when the request completed successfully.

const OnePassNotSupported Status = 411

OnePassNotSupported is returned when 1Password integration isn't supported.

const UnknownError Status = 501

UnknownError is returned when an unknown error occurred.

const UnknownRpcError Status = 503

UnknownRpcError is returned when an unknown error occurred.

const VaultUnspecified Status = 412

VaultUnspecified is returned when a request requires a vault but none was specified.

func Code

func Code(err error) Status

Code returns the status code if the error is an Error, or 0.

func StatusByName

func StatusByName(name string) (Status, bool)

StatusByName returns the named Status.

func (Status) Error

func (s Status) Error() string

Error implements error.

func (Status) GetEnumValue

func (v Status) GetEnumValue() uint64

GetEnumValue returns the value of the Status

func (Status) Is

func (s Status) Is(target error) bool

func (Status) IsKnownError

func (s Status) IsKnownError() bool

func (Status) MarshalJSON

func (v Status) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Status to JSON as a string.

func (*Status) SetEnumValue

func (v *Status) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (Status) Skip

func (s Status) Skip(n int) errors.Factory[Status]

Skip skips N frames when locating the call site.

func (Status) String

func (v Status) String() string

String returns the name of the Status.

func (*Status) UnmarshalJSON

func (v *Status) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Status from JSON as a string.

func (Status) With

func (s Status) With(v ...interface{}) *errors.ErrorBase[Status]

func (Status) WithCauseAndFormat

func (s Status) WithCauseAndFormat(cause error, format string, args ...interface{}) *errors.ErrorBase[Status]

func (Status) WithFormat

func (s Status) WithFormat(format string, args ...interface{}) *errors.ErrorBase[Status]

func (Status) Wrap

func (s Status) Wrap(err error) error

Jump to

Keyboard shortcuts

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