Skip to content

Commit 91b4bca

Browse files
authored
Merge pull request #65 from pusherman/master
(task) check response from writeStream to verify write was successful
2 parents eb2c92b + 764665d commit 91b4bca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Helpers/Cloud.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Sammyjo20\Lasso\Helpers;
44

55
use Illuminate\Support\Facades\Storage;
6+
use League\Flysystem\UnableToWriteFile;
67
use Sammyjo20\Lasso\Exceptions\ConsoleMethodException;
78
use Sammyjo20\Lasso\Helpers\Filesystem as LocalFilesystem;
89

@@ -64,7 +65,9 @@ public function uploadFile(string $path, string $name): void
6465
$stream = fopen($path, 'rb');
6566

6667
// Use the stream to write the bundle to the Filesystem.
67-
$this->cloudFilesystem->writeStream($upload_path, $stream);
68+
if ($this->cloudFilesystem->writeStream($upload_path, $stream) === false) {
69+
throw new UnableToWriteFile("Unable to write file at location " . $upload_path);
70+
}
6871

6972
// Close the Stream pointer because it's good practice.
7073
if (is_resource($stream)) {

0 commit comments

Comments
 (0)