Skip to content

Commit a1d5c97

Browse files
committed
added nice svg on error pages
1 parent 46eb5ce commit a1d5c97

File tree

19 files changed

+956
-0
lines changed

19 files changed

+956
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub/bootstrap
4343
pub/jqueryui
4444
pub/jquery
4545
pub/flags
46+
pub/svg_errors
4647
pub/tinymce
4748
pub/debugbar
4849
pub/sitebase_logo.png

app/App.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class App
6161
public const MEDIA = 'media';
6262
public const ASSETS = 'assets';
6363
public const FLAGS = 'flags';
64+
public const SVG_ERRORS = 'svg_errors';
6465
public const TEMPLATES = 'templates';
6566
public const TRANSLATIONS = 'translations';
6667
public const GRAPHQL = 'graphql';
@@ -483,6 +484,7 @@ public static function getDirs(): array
483484
self::WEBROOT => $rootPath . DS . 'pub',
484485
self::MEDIA => $rootPath . DS . 'media',
485486
self::ASSETS => $rootPath . DS . 'assets',
487+
self::SVG_ERRORS => $rootPath . DS . 'assets' . DS . 'svg_errors',
486488
self::FLAGS => $rootPath . DS . 'assets' . DS . 'flags',
487489
self::TEMPLATES => $rootPath . DS . 'templates',
488490
self::TRANSLATIONS => $rootPath . DS . 'translations',
@@ -606,6 +608,7 @@ public static function installDone() : bool
606608
*/
607609
protected function genericErrorPage(string $title, string $errorMessage, ?Throwable $t = null) : string
608610
{
611+
$exceptionSvg = file_get_contents(static::getDir(static::SVG_ERRORS) . DS . 'exception.svg');
609612
$traceDetails = "";
610613
if ($t) {
611614
$traceDetails = $t->getTraceAsString();
@@ -645,6 +648,7 @@ protected function genericErrorPage(string $title, string $errorMessage, ?Throwa
645648
</head>
646649
<body>
647650
<div class="container">
651+
{$exceptionSvg}
648652
<h1>{$title}</h1>
649653
<p>{$errorMessage}</p>
650654
{$traceDetails}

app/base/commands/App/Deploy.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
146146
App::getDir(App::ROOT) . DS . 'node_modules' . DS . 'highlightjs' . DS . 'styles' . DS . 'default.css' => App::getDir('pub') . DS . 'css' . DS . 'highlight.css',
147147

148148
App::getDir(App::FLAGS) => App::getDir('pub') . DS . 'flags',
149+
App::getDir(App::SVG_ERRORS) => App::getDir('pub') . DS . 'svg_errors',
149150
App::getDir(App::ASSETS) . DS . 'sitebase_logo.png' => App::getDir('pub') . DS . 'sitebase_logo.png',
150151
App::getDir(App::ASSETS) . DS . 'sitebase_logo_small.png' => App::getDir('pub') . DS . 'sitebase_logo_small.png',
151152
App::getDir(App::ASSETS) . DS . 'favicon.ico' => App::getDir('pub') . DS . 'favicon.ico',
@@ -163,6 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
163164
'..' . DS . '..' . DS . 'node_modules' . DS . 'highlightjs' . DS . 'styles' . DS . 'default.css' => App::getDir('pub') . DS . 'css' . DS . 'highlight.css',
164165

165166
'..' . DS . 'assets' . DS . 'flags' => App::getDir('pub') . DS . 'flags',
167+
'..' . DS . 'assets' . DS . 'svg_errors' => App::getDir('pub') . DS . 'svg_errors',
166168
'..' . DS . 'assets' . DS . 'sitebase_logo.png' => App::getDir('pub') . DS . 'sitebase_logo.png',
167169
'..' . DS . 'assets' . DS . 'sitebase_logo_small.png' => App::getDir('pub') . DS . 'sitebase_logo_small.png',
168170
'..' . DS . 'assets' . DS . 'favicon.ico' => App::getDir('pub') . DS . 'favicon.ico',

app/base/tools/Plates/SiteBase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,4 +489,9 @@ public function formatBytes(int $size) : string
489489
{
490490
return $this->getUtils()->formatBytes($size);
491491
}
492+
493+
public function canDebug() : bool
494+
{
495+
return $this->getEnvironment()->canDebug();
496+
}
492497
}

assets/svg_errors/403.svg

Lines changed: 129 additions & 0 deletions
Loading

assets/svg_errors/404.svg

Lines changed: 129 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)