fixed:捕获异常以Json方式返回

This commit is contained in:
JaguarJack
2021-01-20 20:12:08 +08:00
parent 65d3111e65
commit 340e8c356b

View File

@@ -63,6 +63,7 @@ class CatchUpload
*/ */
public function upload(UploadedFile $file): string public function upload(UploadedFile $file): string
{ {
try {
$this->initUploadConfig(); $this->initUploadConfig();
$path = Filesystem::disk($this->getDriver())->putFile($this->getPath(), $file); $path = Filesystem::disk($this->getDriver())->putFile($this->getPath(), $file);
@@ -82,6 +83,10 @@ class CatchUpload
} }
throw new FailedException('Upload Failed, Try Again!'); throw new FailedException('Upload Failed, Try Again!');
} catch (\Exception $exception) {
throw new FailedException($exception->getMessage());
}
} }
/** /**