errorrepo

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 12

README

General framework for error messages

This is a small project but code I used in each project. Registered message should be generate errors correspondingly.

Multilanguage support by registering the message per language and create messages with arguments.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(errID string, args ...interface{}) error

NewError create new error with system language

func NewErrorLocale

func NewErrorLocale(locale, errID string, args ...interface{}) error

NewErrorLocale create new message with given parameter locale locale language given errID error ID of current error args argument for the error

func RegisterDirectory

func RegisterDirectory(fss []fs.DirEntry)

func RegisterMessage

func RegisterMessage(locale, msgData string) error

RegisterMessage register message for locale to be registered in the current error list

Types

type Error

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

func (*Error) Error

func (e *Error) Error() string

Error provide error interface

func (*Error) ID

func (e *Error) ID() string

ID provide error ID

func (*Error) Message

func (e *Error) Message() string

Message provide the error message only

type Message

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

Jump to

Keyboard shortcuts

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