[MM-57826] Make sure the original errors are wrapped when AppErrors are returned (#26771)

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
Ben Schumacher
2024-04-22 12:03:28 +02:00
коммит произвёл GitHub
родитель 423809e0d0
Коммит 8348acac49
33 изменённых файлов: 132 добавлений и 132 удалений

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

@@ -72,7 +72,7 @@ func localUpdateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
diffs, diffErr := config.Diff(oldCfg, newCfg)
if diffErr != nil {
c.Err = model.NewAppError("updateConfig", "api.config.update_config.diff.app_error", nil, diffErr.Error(), http.StatusInternalServerError)
c.Err = model.NewAppError("updateConfig", "api.config.update_config.diff.app_error", nil, "", http.StatusInternalServerError).Wrap(diffErr)
return
}
auditRec.AddEventPriorState(&diffs)
@@ -113,7 +113,7 @@ func localPatchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
})
if mergeErr != nil {
c.Err = model.NewAppError("patchConfig", "api.config.update_config.restricted_merge.app_error", nil, mergeErr.Error(), http.StatusInternalServerError)
c.Err = model.NewAppError("patchConfig", "api.config.update_config.restricted_merge.app_error", nil, "", http.StatusInternalServerError).Wrap(mergeErr)
return
}
@@ -167,7 +167,7 @@ func localMigrateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
err := config.Migrate(from, to)
if err != nil {
c.Err = model.NewAppError("migrateConfig", "api.config.migrate_config.app_error", nil, err.Error(), http.StatusInternalServerError)
c.Err = model.NewAppError("migrateConfig", "api.config.migrate_config.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
return
}