api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount = int64

type AppError

type AppError struct {
	Code     int    `json:"code" example:"400"`
	Message  string `json:"message" example:"Error message"`
	Cause    error  `json:"-"`
	Location string `json:"-"`
}

AppError Implements Error

func NewAuthorizationError

func NewAuthorizationError(err error, message string) *AppError

NewAuthorizationError Create a 401 Unauthorized.

err error The error to wrap.
message string The generic message to show.

func NewBadRequestError

func NewBadRequestError(err error, message string) *AppError

NewBadRequestError Create a 400 Bad Request Error.

err error The error to wrap.
message string The generic message to show.

func NewDBError

func NewDBError(err error, message string) *AppError

NewDBError Create a 500 Internal Server Error due to a DB failure.

err error The error to wrap.
message string The generic message to show.

func NewForbiddenError

func NewForbiddenError(err error, message string) *AppError

NewForbiddenError Create a 403 Forbidden Error.

err error The error to wrap.
message string The generic message to show.

func NewInternalServerError

func NewInternalServerError(err error, message string) *AppError

NewInternalServerError Create a 500 Internal Server Error.

err error The error to wrap.
message string The generic message to show.

func NewNotFoundError

func NewNotFoundError(err error, message string) *AppError

NewNotFoundError Create a 404 Not Found Error.

err error The error to wrap.
message string The generic message to show.

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) GetCause

func (e *AppError) GetCause() error

GetCause Returns the error.

func (*AppError) GetCode

func (e *AppError) GetCode() int

GetCode Returns the error code.

func (*AppError) GetLocation

func (e *AppError) GetLocation() string

GetLocation Returns the error location.

func (*AppError) GetMessage

func (e *AppError) GetMessage() string

GetMessage Returns the error message.

func (*AppError) String

func (e *AppError) String() string

type Error

type Error interface {
	Error() string
	GetCode() int
	GetMessage() string
	GetLocation() string
	GetCause() error
}

Error Enhanced Error interface giving extra-error information.

type UUID

type UUID [16]byte

func (UUID) String

func (u UUID) String() string

Jump to

Keyboard shortcuts

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