errors

package
v0.0.0-...-0ddd045 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errors provides service level errors

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCreateVerifyToken indicates the service failed to create the 2FA verify token
	ErrCreateVerifyToken = New("create-verify-token", "failed to create 2fa verify token", http.StatusInternalServerError)

	// ErrUpdateVerifyToken indicates the service failed to update the 2FA verify token
	ErrUpdateVerifyToken = New("update-verify-token", "failed to update 2fa verify token", http.StatusInternalServerError)

	// ErrInvalidPassword indicates
	ErrInvalidPassword = New("invalid-password", "the user provided an invalid password", http.StatusUnauthorized)
	ErrHashPassword    = New("hash-password", "failed to hash password", http.StatusInternalServerError)
	ErrSignToken       = New("sign-token", "failed to sign jwt token", http.StatusInternalServerError)

	ErrMissingUserData = New("missing-user-data", "data missing to login or register", http.StatusBadRequest)
	ErrBindUser        = New("bind-user", "failed to bind to user model", http.StatusInternalServerError)
	ErrCreateUser      = New("create-user", "failed to create user", http.StatusInternalServerError)
	ErrGetUser         = New("get-user", "failed to get user", http.StatusInternalServerError)

	ErrMissingInviteData = New("missing-invite-data", "data missing to create invite", http.StatusBadRequest)
	ErrBindInvite        = New("bind-invite", "failed to bind to invite model", http.StatusInternalServerError)
	ErrCreateInvite      = New("create-invite", "failed to create invite", http.StatusInternalServerError)

	ErrBindRoom        = New("bind-room", "failed to bind to room model", http.StatusInternalServerError)
	ErrMissingRoomData = New("missing-room-data", "data missing to create room", http.StatusBadRequest)
	ErrCreateRoom      = New("create-room", "failed to create room", http.StatusInternalServerError)
	ErrUpdateRoom      = New("update-room", "failed to update room", http.StatusInternalServerError)

	ErrBindServer        = New("bind-server", "failed to bind to server model", http.StatusInternalServerError)
	ErrMissingServerData = New("missing-server-data", "data missing to create server", http.StatusBadRequest)
	ErrCreateServer      = New("create-server", "failed to create server", http.StatusInternalServerError)

	ErrCreateAvatar = New("create-avatar", "failed to create avatar", http.StatusInternalServerError)
	ErrInvalidHash  = New("invalid-hash", "invalid or empty hash", http.StatusBadRequest)
)

Functions

This section is empty.

Types

type ServiceError

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

ServiceError is a custom error returned form the service layer

func New

func New(err, details string, code int) *ServiceError

New returns a new ServiceError

func (*ServiceError) Code

func (s *ServiceError) Code() int

Code returns the error code

func (*ServiceError) Details

func (s *ServiceError) Details() string

Details returns the detailed error message as a string

func (*ServiceError) Err

func (s *ServiceError) Err() string

Err returns the short error as a string

func (*ServiceError) Error

func (s *ServiceError) Error() string

Error returns the ServiceError in its string representation

func (*ServiceError) IsInternal

func (s *ServiceError) IsInternal() bool

IsInternal returns if the error is an InternalServerError

Jump to

Keyboard shortcuts

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