Skip to content

Commit

Permalink
Rethrow Unable to read file exception for placeholder generation in…
Browse files Browse the repository at this point in the history
… SSG context (#209)

Workaround: #178 (comment)
  • Loading branch information
ncla authored Feb 11, 2023
1 parent 7373747 commit 9305556
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Breakpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Exception;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use League\Flysystem\FilesystemException;
use Statamic\Contracts\Assets\Asset;
Expand Down Expand Up @@ -288,7 +290,10 @@ private function readImageToBase64($assetPath): string|null
$assetContent = $cache->read($assetPath);
$assetMimeType = $cache->mimeType($assetPath);
} catch (FilesystemException $e) {
if (config('app.debug')) {
$isSsgRunning = App::runningInConsole() &&
Str::startsWith(Arr::get(request()->server(), 'argv.1'), ['statamic:ssg:generate', 'ssg:generate']);

if (config('app.debug') || $isSsgRunning) {
throw $e;
}

Expand Down

0 comments on commit 9305556

Please sign in to comment.