cerr

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cerr represents the core layer errors. This package includes the Error struct which helps to wrap common errors with HTTPStatusCode, so the errors may be classified based on their types. It also includes MismatchingSemVerError which is useful in the migration use cases where specific format versions may be expected.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Err            error
	HTTPStatusCode int
}

Error represents an error, aka Err, and assigns a HTTPStatusCode http status code to that error based on its generic category.

func Authentication

func Authentication(err error) *Error

Authentication wraps the err error and marks it as an authentication issue, that is, the caller is not identified and/or authenticated properly.

func Authorization

func Authorization(err error) *Error

Authorization wraps the err error and marks it as an authorization issue, that is, the caller is authenticated but does not have enough permission to invoke that function.

func BadRequest

func BadRequest(err error) *Error

BadRequest wraps the err error and marks it as a bad request, that is, the caller of the function which is returning this error is responsible for that error and may fix it by modifying the args of that function.

func Conflict

func Conflict(err error) *Error

Conflict wraps the err error and marks it as a conflict issue, that is, the requested operation may not be accomplished due to the current conflicting system state.

func NotFound

func NotFound(err error) *Error

NotFound wraps the err error and marks it as a not found issue, that is, the requested object does not exist.

func (*Error) Error

func (e *Error) Error() string

Error implements the error interface, returning a string representation of the Error instance.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped inner error.

type MismatchingSemVerError added in v1.2.0

type MismatchingSemVerError [2]model.SemVer

MismatchingSemVerError indicates an error condition where a specific semantic version was expected, but another version was present. This type is defined as an array containing two semantic version elements. The first element is the expected version and the second element is the actual version.

func (*MismatchingSemVerError) Error added in v1.2.0

func (msve *MismatchingSemVerError) Error() string

Error returns a string representation of `msve` error instance. This method causes *MismatchingSemVerError to implement error interface.

Jump to

Keyboard shortcuts

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