errorutils

package
v0.0.0-...-be2ef80 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatErrorMsg

func FormatErrorMsg(err error, id string) error

Error codes can be found here: https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/errors.go#L15 FormatErrorMsg takes a message and a string id to return a unified error msg across requests

func ProcessInvalid

func ProcessInvalid(err error, msg string) error

ProcessInvalid returns InvalidError

func ProcessNotFound

func ProcessNotFound(err error, id string) error

ProcessNotFound returns NotFoundError

func ProcessSQLNotFound

func ProcessSQLNotFound(err error, id string, wrap string) error

ProcessSQLNotFound checks for err of type sql.ErrNoRows and returns NotFoundError if true, otherwise wrap original error and return

func ProcessUnauthenticated

func ProcessUnauthenticated(err error, msg string) error

ProcessUnauthenticated returns UnauthenticatedError

Types

type InvalidError

type InvalidError struct {
	Msg string
	// contains filtered or unexported fields
}

InvalidError is the error returned when user has provided invalid arguments

func (*InvalidError) Error

func (e *InvalidError) Error() string

type NotFoundError

type NotFoundError struct {
	Id string
	// contains filtered or unexported fields
}

NotFoundError is the error returned when nothing was found

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type UnauthenticatedError

type UnauthenticatedError struct {
	Msg string
	// contains filtered or unexported fields
}

UnauthenticatedError is the error returned when user is not authenticated with an external service such as aws or azure

func (*UnauthenticatedError) Error

func (e *UnauthenticatedError) Error() string

Jump to

Keyboard shortcuts

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