From 2177944f9752c12cd8ebb607aeabe27cb2b01def Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Mon, 16 Oct 2023 16:29:00 +0200 Subject: [PATCH] Catch RealtimeCompiler Dashboard OutOfBoundsException --- .../src/Http/DashboardController.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/realtime-compiler/src/Http/DashboardController.php b/packages/realtime-compiler/src/Http/DashboardController.php index 0b2abb0304c..2053e4d3ca3 100644 --- a/packages/realtime-compiler/src/Http/DashboardController.php +++ b/packages/realtime-compiler/src/Http/DashboardController.php @@ -5,6 +5,7 @@ namespace Hyde\RealtimeCompiler\Http; use Hyde\Hyde; +use OutOfBoundsException; use Hyde\Pages\Concerns\HydePage; use Hyde\Framework\Actions\StaticPageBuilder; use Hyde\Framework\Actions\AnonymousViewCompiler; @@ -46,8 +47,8 @@ public function getProjectInformation(): array { return [ 'Git Version:' => app('git.version'), - 'Hyde Version:' => InstalledVersions::getPrettyVersion('hyde/hyde') ?: 'unreleased', - 'Framework Version:' => InstalledVersions::getPrettyVersion('hyde/framework') ?: 'unreleased', + 'Hyde Version:' => self::getPackageVersion('hyde/hyde'), + 'Framework Version:' => self::getPackageVersion('hyde/framework'), 'Project Path:' => Hyde::path(), ]; } @@ -169,4 +170,15 @@ protected static function welcomeFrame(): string HTML; } + + protected function getPackageVersion(string $packageName): string + { + try { + $prettyVersion = InstalledVersions::getPrettyVersion($packageName); + } catch (OutOfBoundsException) { + // + } + + return $prettyVersion ?? 'unreleased'; + } }