Skip to content

Commit 6a7697d

Browse files
committed
Improved error page customizing
1 parent 7d6df60 commit 6a7697d

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

src/WebApp/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function getMenu($id = NULL) {
329329
return NULL;
330330
}
331331

332-
public function getErrorPage($httpCode) {
332+
public function getErrorPage($httpCode, $text, $throwable = NULL) {
333333
return NULL;
334334
}
335335

src/WebApp/Service.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public function run() {
3535
}
3636
} catch (\Throwable $e) {
3737
\TgLog\Log::error('Cannot create application', $e);
38-
$page = new Error\ErrorPage($this->app, 500, 'Internal Error', $e);
38+
$page = $this->theme->getErrorPage(500, 'Internal Error', $e);
39+
// $page = new Error\ErrorPage($this->app, 500, 'Internal Error', $e);
3940
$page->processRequest();
4041
$this->theme->render($page);
4142
}
@@ -63,7 +64,7 @@ protected function createPage() {
6364

6465
// Get a specific error page from the theme
6566
if ($page == NULL) {
66-
$page = $this->theme->getErrorPage(404);
67+
$page = $this->theme->getErrorPage(404, 'Error');
6768
}
6869

6970
// Get the default error page
@@ -73,7 +74,8 @@ protected function createPage() {
7374
return $page;
7475
} catch (\Throwable $e) {
7576
\TgLog\Log::error('Cannot create application', $e);
76-
return new Error\ErrorPage($this->app, 500, 'Internal Error', $e);
77+
return $this->theme->getErrorPage(500, 'Internal Error', $e);
78+
//return new Error\ErrorPage($this->app, 500, 'Internal Error', $e);
7779
}
7880
}
7981

src/WebApp/Theme.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ public function hasFeature($name) {
183183
return in_array($name, $this->features);
184184
}
185185

186-
public function getErrorPage($htmlCode) {
187-
$rc = $this->app->getErrorPage($htmlCode);
188-
if ($rc == NULL) $rc = new \WebApp\Error\ErrorPage($this->app, $htmlCode, 'Error');
186+
public function getErrorPage($htmlCode, $text, $throwable = NULL) {
187+
$rc = $this->app->getErrorPage($htmlCode, $text, $throwable);
188+
if ($rc == NULL) $rc = new \WebApp\Error\ErrorPage($this->app, $htmlCode, $text, $throwable);
189189
return $rc;
190190
}
191191
}

src/i18n.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
),
132132
'error_page_title' => array(
133133
'de' => 'Gratulation!',
134-
'en' => 'Congratulation!',
134+
'en' => 'Congrats!',
135135
),
136136
'error_page_subtitle' => array(
137137
'de' => 'Jetzt habt Ihr die Seite kaputt gemacht.',

0 commit comments

Comments
 (0)