errors

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors provides an interface for all errors returned from Tharsis.

Index

Constants

View Source
const (
	EInternal        = "internal error"
	ENotImplemented  = "not implemented"
	ENotFound        = "not found"
	EConflict        = "conflict"
	EOptimisticLock  = "optimistic lock"
	EInvalid         = "invalid"
	EForbidden       = "forbidden"
	ETooManyRequests = "too many requests"
	EUnauthorized    = "unauthorized"
	ETooLarge        = "request too large"
)

Error code constants

Variables

This section is empty.

Functions

func ErrorCode

func ErrorCode(err error) string

ErrorCode returns the code of the root error, if available; otherwise returns EINTERNAL.

func ErrorMessage

func ErrorMessage(err error) string

ErrorMessage returns the messages associated with the error

Types

type TharsisError

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

TharsisError is the internal error implementation for the Tharsis API

func New

func New(code string, format string, a ...any) *TharsisError

New returns a new Tharsis error with the code and message fields set

func Wrap

func Wrap(err error, code string, format string, a ...any) *TharsisError

Wrap returns a new TharsisError which wraps an existing error

func (*TharsisError) Error

func (e *TharsisError) Error() string

Error implements the error interface by writing out the recursive messages.

Jump to

Keyboard shortcuts

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