Skip to content

Commit

Permalink
Merge pull request #1384 from hydephp/catch-realtime-compiler-dashboa…
Browse files Browse the repository at this point in the history
…rd-out-of-bounds-exception

Catch RealtimeCompiler Dashboard OutOfBoundsException
  • Loading branch information
caendesilva committed Oct 16, 2023
2 parents 9755d13 + 2177944 commit cdd0c10
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/realtime-compiler/src/Http/DashboardController.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
];
}
Expand Down Expand Up @@ -169,4 +170,15 @@ protected static function welcomeFrame(): string
</aside>
HTML;
}

protected function getPackageVersion(string $packageName): string
{
try {
$prettyVersion = InstalledVersions::getPrettyVersion($packageName);
} catch (OutOfBoundsException) {
//
}

return $prettyVersion ?? 'unreleased';
}
}

0 comments on commit cdd0c10

Please sign in to comment.