feat: 上传文件到 oss 遇到错误时,应该返回错误,避免 panic (#1890)

This commit is contained in:
3vilive
2024-09-27 20:54:44 +08:00
committed by GitHub
parent b98094ceee
commit 4c46bdaa7f
2 changed files with 3 additions and 3 deletions

View File

@@ -32,8 +32,8 @@ func (b *FileUploadAndDownloadApi) UploadFile(c *gin.Context) {
}
file, err = fileUploadAndDownloadService.UploadFile(header, noSave) // 文件上传后拿到文件路径
if err != nil {
global.GVA_LOG.Error("修改数据库链接失败!", zap.Error(err))
response.FailWithMessage("修改数据库链接失败", c)
global.GVA_LOG.Error("上传文件失败!", zap.Error(err))
response.FailWithMessage("上传文件失败", c)
return
}
response.OkWithDetailed(exampleRes.ExaFileResponse{File: file}, "上传成功", c)