errors

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: AGPL-3.0, AGPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const ERR_API_DUPLICATE_VALUE_ON_KEY = "DUPLICATE_VALUE_ON_KEY"
View Source
const ERR_API_MISMATCH_VALUE_ON_KEY = "MISMATCH_VALUE_ON_KEY"
View Source
const ERR_API_NO_DATA_FOUND = "NO_DATA_FOUND"
View Source
const ERR_API_NO_DATA_FOUND_ON_KEY = "NO_DATA_FOUND_ON_KEY"
View Source
const ERR_API_REFERENCE_DOES_NOT_EXISTS = "REFERENCE_DOES_NOT_EXISTS"
View Source
const ERR_COMMON_ERROR = "COMMON_ERROR"
View Source
const ERR_CONFIG_FILE_LOAD_ERROR = "CONFIG_FILE_LOAD_ERROR"
View Source
const ERR_CONFIG_FILE_NOT_EXISTS = "CONFIG_FILE_NOT_EXISTS"
View Source
const ERR_CONTEXT_CLOSED_ERROR = "CONTEXT_CLOSED_ERROR"
View Source
const ERR_DB_CLOSE_ERROR = "DB_CLOSE_ERROR"
View Source
const ERR_DB_CONNECTION_ERROR = "DB_CONNECTION_ERROR"
View Source
const ERR_DB_EXEC_ERROR = "DB_EXEC_ERROR"
View Source
const ERR_DB_EXEC_ROW_COUNT_ERROR = "DB_EXEC_ROW_COUNT_ERROR"
View Source
const ERR_DB_GET_ERROR = "DB_GET_ERROR"
View Source
const ERR_DB_QUERYROWX_ERROR = "DB_QUERYROWX_ERROR"
View Source
const ERR_DB_QUERYROW_ERROR = "DB_QUERYROW_ERROR"
View Source
const ERR_DB_SELECT_ERROR = "DB_SELECT_ERROR"
View Source
const ERR_DB_SQL_STM_NOT_DEFINED_ERROR = "DB_SQL_STM_NOT_DEFINED_ERROR"
View Source
const ERR_DB_SQL_STM_PREPARE_ERROR = "DB_SQL_STM_PREPARE_ERROR"
View Source
const ERR_DB_TOO_MANY_ROWS_ERROR = "DB_TOO_MANY_ROWS_ERROR"
View Source
const ERR_DB_TX_COMMIT_ERROR = "DB_TX_COMMIT_ERROR"
View Source
const ERR_DB_TX_CREATE_ERROR = "DB_TX_CREATE_ERROR"
View Source
const ERR_DB_TX_NOT_DEFINED_ERROR = "DB_TX_NOT_DEFINED_ERROR"
View Source
const ERR_DB_TX_ROLLBAK_ERROR = "DB_TX_ROLLBAK_ERROR"
View Source
const ERR_EMPTY_CONFIG_FILE = "EMPTY_CONFIG_FILE"
View Source
const ERR_EMPTY_HTTP_USER = "EMPTY_HTTP_USER"
View Source
const ERR_EMPTY_JWT_KEY = "EMPTY_JWT_KEY"
View Source
const ERR_ERROR = "ERROR"
View Source
const ERR_EXPR_COMMON_ERROR = "EXPR_COMMON_ERROR"
View Source
const ERR_FILE_OPEN_ERROR = "FILE_OPEN_ERROR"
View Source
const ERR_FILE_SYNC_ERROR = "FILE_SYNC_ERROR"
View Source
const ERR_HTTP_AUTH_BASIC_ERROR = "HTTP_AUTH_BASIC_ERROR"
View Source
const ERR_HTTP_AUTH_BASIC_NOT_SET_ERROR = "HTTP_AUTH_BASIC_NOT_SET_ERROR"
View Source
const ERR_HTTP_AUTH_JWT_EXPIRED_ERROR = "HTTP_AUTH_JWT_EXPIRED_ERROR"
View Source
const ERR_HTTP_AUTH_JWT_INVALID_ERROR = "HTTP_AUTH_JWT_INVALID_ERROR"
View Source
const ERR_HTTP_AUTH_JWT_NOT_SET_ERROR = "HTTP_AUTH_JWT_NOT_SET_ERROR"
View Source
const ERR_HTTP_AUTH_MSAD_ERROR = "HTTP_AUTH_MSAD_ERROR"
View Source
const ERR_HTTP_AUTH_MSAD_INVALID_ERROR = "HTTP_AUTH_MSAD_INVALID_ERROR"
View Source
const ERR_HTTP_BODY_READ_ERROR = "HTTP_BODY_READ_ERROR"
View Source
const ERR_HTTP_CALL_CREATE_CONTEXT_ERROR = "HTTP_CALL_CREATE_CONTEXT_ERROR"
View Source
const ERR_HTTP_CALL_EMPTY_URL = "HTTP_CALL_EMPTY_URL"
View Source
const ERR_HTTP_CALL_METHOD_NOT_ALLOWED_ERROR = "HTTP_CALL_METHOD_NOT_ALLOWED_ERROR"
View Source
const ERR_HTTP_CALL_OTHER_ERROR = "HTTP_CALL_OTHER_ERROR"
View Source
const ERR_HTTP_CALL_OTHER_NETURL_ERROR = "HTTP_CALL_OTHER_NETURL_ERROR"
View Source
const ERR_HTTP_CALL_READ_BODY_ERROR = "HTTP_CALL_READ_BODY_ERROR"
View Source
const ERR_HTTP_CALL_TIMEOUT_ERROR = "HTTP_CALL_TIMEOUT_ERROR"
View Source
const ERR_HTTP_CALL_URL_NOT_FOUND_ERROR = "HTTP_CALL_URL_NOT_FOUND_ERROR"
View Source
const ERR_HTTP_DUMP_REQUEST_ERROR = "HTTP_DUMP_REQUEST_ERROR"
View Source
const ERR_HTTP_HANDLER_METHOD_NOT_FOUND = "HTTP_HANDLER_METHOD_NOT_FOUND"
View Source
const ERR_HTTP_HEADER_INCORRECT_BOOL = "HTTP_HEADER_INCORRECT_BOOL"
View Source
const ERR_HTTP_LISTENER_CREATE_ERROR = "HTTP_LISTENER_CREATE_ERROR"
View Source
const ERR_HTTP_METHOD_NOT_ALLOWED_ERROR = "HTTP_METHOD_NOT_ALLOWED_ERROR"
View Source
const ERR_HTTP_REQUEST_WRITE_ERROR = "HTTP_REQUEST_WRITE_ERROR"
View Source
const ERR_HTTP_SERVER_SHUTDOWN_ERROR = "HTTP_SERVER_SHUTDOWN_ERROR"
View Source
const ERR_INCORRECT_ARG_NUM_ERROR = "INCORRECT_ARG_NUM_ERROR"
View Source
const ERR_INCORRECT_AUTH_TYPE = "INCORRECT_AUTH_TYPE"
View Source
const ERR_INCORRECT_CALL_ERROR = "INCORRECT_CALL_ERROR"
View Source
const ERR_INCORRECT_ENTITY_SOURCE = "INCORRECT_ENTITY_SOURCE"
View Source
const ERR_INCORRECT_LOG_LEVEL = "INCORRECT_LOG_LEVEL"
View Source
const ERR_INCORRECT_TYPE_ERROR = "INCORRECT_TYPE_ERROR"
View Source
const ERR_INT_PARSE_ERROR = "INT_PARSE_ERROR"
View Source
const ERR_JSON_MARSHAL_ERROR = "JSON_MARSHAL_ERROR"
View Source
const ERR_JSON_UNMARSHAL_ERROR = "JSON_UNMARSHAL_ERROR"
View Source
const ERR_MESSAGE_NOT_FOUND = "MESSAGE_NOT_FOUND"
View Source
const ERR_PANIC_RECOVER_ERROR = "PANIC_RECOVER_ERROR"
View Source
const ERR_REFLECT_INCORRECT_TYPE = "REFLECT_INCORRECT_TYPE"
View Source
const ERR_TIMEOUT_ERROR = "TIMEOUT_ERROR"
View Source
const ERR_TIME_FORMAT_ERROR = "TIME_FORMAT_ERROR"
View Source
const ERR_UNDEFINED_ID = uint64(0)
View Source
const ERR_VALIDATOR_COMMON_ERROR = "VALIDATOR_COMMON_ERROR"
View Source
const ERR_VALIDATOR_FIELD_COMMON_ERROR = "VALIDATOR_FIELD_COMMON_ERROR"
View Source
const ERR_VALIDATOR_MDG_ERROR = "VALIDATOR_MDG_ERROR"
View Source
const ERR_VALIDATOR_STRUCT_ERROR = "VALIDATOR_STRUCT_ERROR"
View Source
const ERR_WORKER_POOL_ADD_TASK_INCORRECT_STATE = "WORKER_POOL_ADD_TASK_INCORRECT_STATE"
View Source
const ERR_WORKER_POOL_ALREADY_LOCKED = "WORKER_POOL_ALREADY_LOCKED"
View Source
const ERR_WORKER_POOL_CONTEXT_CLOSED = "WORKER_POOL_CONTEXT_CLOSED"
View Source
const ERR_WORKER_POOL_INCOMPLETE_DONE = "WORKER_POOL_INCOMPLETE_DONE"
View Source
const ERR_WORKER_POOL_IS_SHUTTING_DOWN = "WORKER_POOL_IS_SHUTTING_DOWN"
View Source
const ERR_WORKER_POOL_RUN_INCORRECT_STATE = "WORKER_POOL_RUN_INCORRECT_STATE"
View Source
const ERR_WORKER_POOL_STOP_SIGNAL = "WORKER_POOL_STOP_SIGNAL"
View Source
const ERR_WORKER_POOL_TASK_ALREADY_LOCKED = "WORKER_POOL_TASK_ALREADY_LOCKED"
View Source
const ERR_WORKER_POOL_TASK_CHANNEL_CLOSED = "WORKER_POOL_TASK_CHANNEL_CLOSED"
View Source
const ERR_WORKER_POOL_TASK_COUNT_ERROR = "WORKER_POOL_TASK_COUNT_ERROR"
View Source
const ERR_WORKER_POOL_TASK_INCORRECT_STATE = "WORKER_POOL_TASK_INCORRECT_STATE"
View Source
const ERR_WORKER_POOL_TIMEOUT_ERROR = "WORKER_POOL_TIMEOUT_ERROR"
View Source
const ERR_WORKER_POOL_WORKER_ERROR = "WORKER_POOL_WORKER_ERROR"
View Source
const ERR_XLSX_COMMON_ERROR = "XLSX_COMMON_ERROR"
View Source
const ERR_XML_MARSHAL_ERROR = "XML_MARSHAL_ERROR"
View Source
const ERR_XML_UNMARSHAL_ERROR = "XML_UNMARSHAL_ERROR"
View Source
const ERR_YAML_MARSHAL_ERROR = "YAML_MARSHAL_ERROR"
View Source
const ERR_YAML_UNMARSHAL_ERROR = "YAML_UNMARSHAL_ERROR"

Variables

This section is empty.

Functions

func AppendTypedErrorMessages

func AppendTypedErrorMessages(errorMessage map[string]ErrorMessage)

AppendTypedErrorMessages - добавить сообщения в набор сообщений об ошибках

func GetArgsString

func GetArgsString(args ...interface{}) (argsStr string)

GetArgsString return formated string with arguments

func GetTrace

func GetTrace() string

GetTrace - напечатать trace

func GetTypedMess

func GetTypedMess(key string, args ...interface{}) (code string, text string)

GetTypedMess Добавить типизированное сообщение

func SetTypedErrorMessages

func SetTypedErrorMessages(errorMessage map[string]ErrorMessage)

SetTypedErrorMessages - установить набор сообщений об ошибках

Types

type Error

type Error struct {
	ID           uint64          `json:"id,omitempty" xml:"id,omitempty" yaml:"id,omitempty"`                                  // уникальный номер ошибки
	ExternalId   uint64          `json:"external_id,omitempty" xml:"external_id,omitempty" yaml:"external_id,omitempty"`       // внешний ID, который был передан при создании ошибки
	Code         string          `json:"code,omitempty" xml:"code,omitempty" yaml:"code,omitempty"`                            // код ошибки
	Message      string          `json:"message,omitempty" xml:"message,omitempty" yaml:"message,omitempty"`                   // текст ошибки
	Details      []string        `json:"details,omitempty" xml:"details,omitempty" yaml:"details,omitempty"`                   // текст ошибки подробный
	Caller       string          `json:"caller,omitempty" xml:"caller,omitempty" yaml:"caller,omitempty"`                      // файл, строка и наименование метода в котором произошла ошибка
	Args         string          `json:"args,omitempty" xml:"args,omitempty" yaml:"args,omitempty"`                            // строка аргументов
	CauseMessage string          `json:"cause_message,omitempty" xml:"cause_message,omitempty" yaml:"cause_message,omitempty"` // текст ошибки - причины
	CauseErr     error           `json:"cause_err,omitempty" xml:"cause_err,omitempty" yaml:"cause_err,omitempty"`             // ошибка - причина
	Trace        string          `json:"trace,omitempty" xml:"trace,omitempty" yaml:"trace,omitempty"`                         // стек вызова
	Errors       Errors          `json:"errors,omitempty" xml:"errors,omitempty" yaml:"errors,omitempty"`                      // связанные ошибки
	Extra        interface{}     `json:"extra_info,omitempty" xml:"extra_info,omitempty" yaml:"extra_info,omitempty"`          // дополнительная информация
	MessageJson  json.RawMessage `json:"extra_info_json,omitempty"`                                                            // текст ошибки в formate Json
}

Error represent custom error

func New

func New(code string, msg string, args ...interface{}) *Error

New - create new custom error

func NewTraceEmpty

func NewTraceEmpty(code string, msg string, args ...interface{}) *Error

NewTraceEmpty - create new custom error

func NewTyped

func NewTyped(key string, externalId uint64, args ...interface{}) *Error

NewTyped - create new typed custom error

func NewTypedTraceEmpty

func NewTypedTraceEmpty(key string, externalId uint64, args ...interface{}) *Error

NewTypedTraceEmpty - create new typed custom error

func WithCause

func WithCause(code string, msg string, causeErr error, args ...interface{}) *Error

WithCause - create new custom error with cause

func WithCauseTyped

func WithCauseTyped(key string, externalId uint64, causeErr error, args ...interface{}) *Error

WithCauseTyped - create new custom error with cause

func (*Error) Error

func (e *Error) Error() string

Error print custom error

func (*Error) Format

func (e *Error) Format(s fmt.State, verb rune)

Format output

,omitempty"%s print the error code, message, arguments, and cause message.

%v    in addition to %s, print caller
%+v   extended format. Each Frame of the error's StackTrace will be printed in detail.

func (*Error) PrintfDebug

func (e *Error) PrintfDebug(depths ...int) *Error

PrintfDebug print custom error

func (*Error) PrintfError

func (e *Error) PrintfError(depths ...int) *Error

PrintfError print custom error

func (*Error) PrintfInfo

func (e *Error) PrintfInfo(depths ...int) *Error

PrintfInfo print custom error

type ErrorMessage

type ErrorMessage struct {
	Code string `json:"code"`
	Text string `json:"text"`
}

ErrorMessage Сообщения

type Errors

type Errors []*Error

func (*Errors) Append

func (errors *Errors) Append(externalId uint64, err error) *Errors

func (*Errors) AppendErrors

func (errors *Errors) AppendErrors(addErrors Errors) Errors

func (*Errors) Clear

func (errors *Errors) Clear()

func (*Errors) Error

func (errors *Errors) Error(externalId uint64, messageText string) error

func (*Errors) HasError

func (errors *Errors) HasError() bool

Jump to

Keyboard shortcuts

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