From b50420f89d22c15a1e8a044a221880964e5da960 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 10 Dec 2019 19:38:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/modules/file/logic/file/FileManager.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/modules/file/logic/file/FileManager.php b/backend/modules/file/logic/file/FileManager.php index a5b13ec..15a13cb 100755 --- a/backend/modules/file/logic/file/FileManager.php +++ b/backend/modules/file/logic/file/FileManager.php @@ -7,6 +7,7 @@ use backend\modules\file\models\ars\File; use backend\modules\file\models\ars\TemFile; use yii\web\HttpException; use yii; +use yii\web\ServerErrorHttpException; class FileManager { @@ -46,7 +47,8 @@ class FileManager * @param $ownId * @param $ownType * @return array|bool - * @throws \Exception + * @throws HttpException + * @throws ServerErrorHttpException * 根据临时文件id将临时文件保存在文件中 */ public function saveTemFileToFile($temFileIdArr, $ownId, $ownType) @@ -71,9 +73,9 @@ class FileManager $tra->commit(); return ['status' => true, 'info' => '保存成功', 'first_file_id' => $firstFileId]; - } catch (\Exception $e) { + } catch (yii\db\Exception $e) { $tra->rollBack(); - throw new \Exception($e->getMessage()); + throw new ServerErrorHttpException($e->getMessage()); } }