Consistent error wrapping (#30600)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
64ff2434ee
Коммит
354d7aeb72
@@ -961,7 +961,7 @@ func (a *App) importProfileImage(rctx request.CTX, userID string, data *imports.
|
||||
|
||||
if file != nil {
|
||||
if limitErr := checkImageLimits(file, *a.Config().FileSettings.MaxImageResolution); limitErr != nil {
|
||||
return model.NewAppError("SetProfileImage", "api.user.upload_profile_user.check_image_limits.app_error", nil, "", http.StatusBadRequest)
|
||||
return model.NewAppError("SetProfileImage", "api.user.upload_profile_user.check_image_limits.app_error", nil, "", http.StatusBadRequest).Wrap(limitErr)
|
||||
}
|
||||
if err := a.SetProfileImageFromFile(rctx, userID, file); err != nil {
|
||||
rctx.Logger().Warn("Unable to set the profile image from a file.", mlog.Err(err))
|
||||
@@ -1613,7 +1613,7 @@ func (a *App) importAttachment(rctx request.CTX, data *imports.AttachmentImportD
|
||||
if post.Id != "" {
|
||||
oldFiles, err := a.Srv().Store().FileInfo().GetForPost(post.Id, true, false, true)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest)
|
||||
return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
for _, oldFile := range oldFiles {
|
||||
if oldFile.Name != path.Base(name) || oldFile.Size != fileSize {
|
||||
@@ -1622,7 +1622,7 @@ func (a *App) importAttachment(rctx request.CTX, data *imports.AttachmentImportD
|
||||
|
||||
oldFileReader, appErr := a.FileReader(oldFile.Path)
|
||||
if appErr != nil {
|
||||
return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest)
|
||||
return nil, model.NewAppError("BulkImport", "app.import.attachment.file_upload.error", map[string]any{"FilePath": *data.Path}, "", http.StatusBadRequest).Wrap(appErr)
|
||||
}
|
||||
defer oldFileReader.Close()
|
||||
|
||||
@@ -2564,7 +2564,7 @@ func (a *App) importEmoji(rctx request.CTX, data *imports.EmojiImportData, dryRu
|
||||
file, err = os.Open(*data.Image)
|
||||
}
|
||||
if err != nil {
|
||||
return model.NewAppError("BulkImport", "app.import.emoji.bad_file.error", map[string]any{"EmojiName": *data.Name}, "", http.StatusBadRequest)
|
||||
return model.NewAppError("BulkImport", "app.import.emoji.bad_file.error", map[string]any{"EmojiName": *data.Name}, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user