Improve error messages when fetching description on babelio
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
type TranslatedError struct {
|
||||
Err error
|
||||
Arg string
|
||||
}
|
||||
|
||||
type HttpError struct {
|
||||
@@ -67,6 +68,10 @@ func (e TranslatedError) Error() string {
|
||||
return fmt.Sprintf("%v", e.Err)
|
||||
}
|
||||
|
||||
func (e TranslatedError) ToTranslatedMessage(ac *appcontext.AppContext) string {
|
||||
return fmt.Sprintf(i18nresource.GetTranslatedMessage(ac, e.Error()), e.Arg)
|
||||
}
|
||||
|
||||
type apiValidationError struct {
|
||||
Field string `json:"field"`
|
||||
Err string `json:"error"`
|
||||
|
||||
Reference in New Issue
Block a user