Skip to content

Commit

Permalink
Fix wrong exception thrown on failed upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Warxcell committed May 21, 2024
1 parent 97599ce commit 7eed2a2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
use SplFileObject;
use Symfony\Component\HttpFoundation\File\UploadedFile;

use Throwable;

use function clearstatcache;
use function copy;
use function fclose;
Expand Down Expand Up @@ -96,7 +98,7 @@ public function upload(SplFileInfo $splFileInfo): File
{
try {
$handledSplFile = $this->handleSplFile($splFileInfo);
} catch (ErrorException $exception) {
} catch (Throwable $exception) {
throw new UnableToUpload($splFileInfo, $exception);
}

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

try {
$splFileInfo = $this->handleSplFile($splFileInfo);
} catch (ErrorException $exception) {
} catch (Throwable $exception) {
throw FileException::unableToWrite($file, $exception);
}

Expand Down Expand Up @@ -281,7 +283,7 @@ public function clear(): void
}

/**
* @throws ErrorException
* @throws Throwable
*/
private function handleSplFile(SplFileInfo $file): SplFileInfo
{
Expand Down

0 comments on commit 7eed2a2

Please sign in to comment.