func (e *ErrorBag) Add(key, message string) {
	e.AddData(key, message, map[string]string{})
}
Add adds a new error to the ErrorBag.
package validation
import (
	"fmt"
	"go-webapp-example/pkg/i18n"
	"github.com/pkg/errors"
)
var ErrFailed = errors.New("validation failed")
type Errors map[string][]Error
type ErrorBag struct {
	errors  Errors
	subject string
}
type Error struct {
	Key        string            `json:"key"`
	Message    string            `json:"message"`
	Translated string            `json:"translated"`
	Data       map[string]string `json:"data"`
}
func NewErrorBag(subject string) *ErrorBag {
	return &ErrorBag{
		subject: subject,
		errors:  make(Errors),
	}
}
func ConvertError(key string, err error) Errors {
	converted := Error{Message: err.Error(), Key: key}
	return Errors{key: []Error{converted}}
}
func NewFromString(key, message string) Errors {
	converted := Error{Message: message, Key: key}
	return Errors{key: []Error{converted}}
}