package errors import ( "errors" "fmt" ) type Error struct { Code int Message string } func (e *Error) Error() string { return fmt.Sprintf("code: %d, message: %s", e.Code, e.Message) } func Format(code int, msg string, args ...any) Error { return Error{ Code: code, Message: fmt.Sprintf(msg, args...), } } func Is(err, target error) bool { return errors.Is(err, target) } func New(code int, message string) *Error { return &Error{ Code: code, Message: message, } }