Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethrow exception about being unable to read file for placeholder generation in SSG context #209

Merged
merged 7 commits into from
Feb 11, 2023
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