icop_error

package
v0.0.0-...-d0dd730 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

View Source
const (
	GeneralError          = 1    //Used for global error handling to the client
	BindError             = 2    //Used if the data from the client could not be bound
	JwtError              = 3    //returned, if the jwt token is not valid
	InvalidArgument       = 1000 //used to signal any invalid argument
	EmailExists           = 1001 //returned on registration if email exists
	MissingMandatoryField = 1002
	MobileNotCountry      = 1003 //returned if mobile does not match country
	InvalidLength         = 1004
	MasterKySameAsIV      = 1005 //returned if the IV is the same as the masterkey
	TokenExpiered         = 1006 //returned if mail token expiered
	JWTExpired            = 1007
	EmailAlreadyConfirmed = 1008 //returned if email was already confirmed before
	TfaAlreadyConfirmed   = 1009 //returned if 2fa already done
	EmailNotConfigured    = 1010
	MnemonicNotConfigured = 1011
	TfaNotYetConfirmed    = 1012 //returned if 2fa not yet confirmed
	//InvalidPassword            = 1013 //returned if passed in publickey188 does not match
	UserInactive               = 1014 //returned if the user is inactive
	NoPermission               = 1015 //returned if the user has not permission to the ressource
	UserNotExists              = 1016 //returned if user is not found in the db
	WalletFederationNameExists = 1017 //returned if federation name already exists
	WalletIsLast               = 1018 //returned if federation name already exists
	OrderWrongStatus           = 1019 //returned if order has the wrong status for the desired action
	NoActivePhase              = 1020 //returned if no active phase was found
	InsufficientCoins          = 1021 //returned if there are not suffuciant coins for the order
	StellarAccountNotExists    = 1022 //returned if the stellar account does not exists
	StellarTrustlineNotExists  = 1023 //returned if the trustline does not exists
	ToMuchOrdersPerPhase       = 1024 //returned if the user exceeded the max numbers of orders per phase
	OrderMinTokens             = 1025 //returned if to less tokens ordered
	OrderMaxTokens             = 1026 //returned if to much tokens ordered
	UserShouldExist            = 1027 //returned if user was allready created by the system once
	UserIsClosed               = 1028 //returned if user is closed
	UserIsSuspended            = 1029 //returned if user is suspended

	ValidBadInputData = "Bad input data"
)

global Error codes

Variables

This section is empty.

Functions

This section is empty.

Types

type IcopError

type IcopError struct {
	ErrorCode           int    `json:"error_code,omitempty"`
	ParameterName       string `json:"parameter_name,omitempty"`
	UserErrorMessageKey string `json:"user_error_message_key,omitempty"`
	ErrorMessage        string `json:"error_message,omitempty"`
}

IcopError are the details for the validations

type IcopErrors

type IcopErrors []IcopError

IcopErrors is the list of all errors returned

func LogAndReturnError

func LogAndReturnError(log *logrus.Entry, err error, errorMessage string, errorCode int) IcopErrors

LogAndReturnError logs an error to stdout and returns a struct with the code and passed message

func LogAndReturnIcopError

func LogAndReturnIcopError(log *logrus.Entry, paramName string, errorCode int, errorMessage string, userErrorMessageKey string) IcopErrors

LogAndReturnIcopError logs an error to stdout and returns a struct with the code and passed message

func NewIcopError

func NewIcopError(paramNane string, errorCode int, errorMessage string, userErrorMessageKey string) IcopErrors

NewIcopError returns a new List of icop errors, initialized with one error

func NewIcopErrorShort

func NewIcopErrorShort(errorCode int, errorMessage string) IcopErrors

NewIcopErrorShort returns a new List of icop errors, initialized with one error

func ValidateStruct

func ValidateStruct(log *logrus.Entry, data interface{}) (bool, IcopErrors)

ValidateStruct validates the struct and returns an errorlist (or empty error slice)

func (*IcopErrors) AddError

func (e *IcopErrors) AddError(paramNane string, errorCode int, errorMessage string, userErrorMessageKey string)

AddError adds a new Error to the response

func (IcopErrors) GetJSON

func (e IcopErrors) GetJSON(log *logrus.Entry) []byte

GetJSON returns the JSON for the errorstruct

Jump to

Keyboard shortcuts

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