add errors printing when i18n files loading failed for gi18n

This commit is contained in:
John
2019-09-06 15:43:57 +08:00
parent 8f953dabe5
commit 8fd88307f7
3 changed files with 19 additions and 28 deletions

View File

@ -30,6 +30,17 @@ func New(text string) error {
}
}
// Newf returns an error that formats as the given text.
func Newf(format string, args ...interface{}) error {
if format == "" {
return nil
}
return &Error{
stack: callers(),
text: fmt.Sprintf(format, args...),
}
}
// Wrap wraps error with text.
// It returns nil if given err is nil.
func Wrap(err error, text string) error {