Skip to content

Commit 7eed2a2

Browse files
committed
Fix wrong exception thrown on failed upload
1 parent 97599ce commit 7eed2a2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Manager.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use SplFileObject;
2424
use Symfony\Component\HttpFoundation\File\UploadedFile;
2525

26+
use Throwable;
27+
2628
use function clearstatcache;
2729
use function copy;
2830
use function fclose;
@@ -96,7 +98,7 @@ public function upload(SplFileInfo $splFileInfo): File
9698
{
9799
try {
98100
$handledSplFile = $this->handleSplFile($splFileInfo);
99-
} catch (ErrorException $exception) {
101+
} catch (Throwable $exception) {
100102
throw new UnableToUpload($splFileInfo, $exception);
101103
}
102104

@@ -231,7 +233,7 @@ public function write(MutableFile $file, SplFileInfo $splFileInfo): void
231233

232234
try {
233235
$splFileInfo = $this->handleSplFile($splFileInfo);
234-
} catch (ErrorException $exception) {
236+
} catch (Throwable $exception) {
235237
throw FileException::unableToWrite($file, $exception);
236238
}
237239

@@ -281,7 +283,7 @@ public function clear(): void
281283
}
282284

283285
/**
284-
* @throws ErrorException
286+
* @throws Throwable
285287
*/
286288
private function handleSplFile(SplFileInfo $file): SplFileInfo
287289
{

0 commit comments

Comments
 (0)