Remove the word "<untranslated>" from appearing
in the logs.

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2023-01-03 20:14:45 +05:30
коммит произвёл GitHub
родитель 6ad1861535
Коммит 356188de28
2 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@@ -256,11 +256,15 @@ func (er *AppError) Error() string {
// render the error information
sb.WriteString(er.Where)
sb.WriteString(": ")
sb.WriteString(er.Message)
if er.Message != NoTranslation {
sb.WriteString(er.Message)
}
// only render the detailed error when it's present
if er.DetailedError != "" {
sb.WriteString(", ")
if er.Message != NoTranslation {
sb.WriteString(", ")
}
sb.WriteString(er.DetailedError)
}

Просмотреть файл

@@ -81,6 +81,11 @@ func TestAppError(t *testing.T) {
t.Log(appErr.Error())
}
func TestAppErrorNoTranslation(t *testing.T) {
appErr := NewAppError("TestAppError", NoTranslation, nil, "test error", http.StatusBadRequest)
require.Equal(t, "TestAppError: test error", appErr.Error())
}
func TestAppErrorJunk(t *testing.T) {
rerr := AppErrorFromJSON(strings.NewReader("<html><body>This is a broken test</body></html>"))
require.Equal(t, "body: <html><body>This is a broken test</body></html>", rerr.DetailedError)