Skip to content

Commit 313a113

Browse files
committed
fix: patch up error codes
1 parent 064a24f commit 313a113

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/Exception/General.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public static function handleErrors($errno, $errstr = '', $errfile = '', $errlin
6666
try {
6767
throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
6868
} catch (\Throwable $th) {
69-
$app = \Leaf\Config::get("app")["instance"];
69+
$app = \Leaf\Config::get('app')['instance'];
7070

71-
if ($app && $app->config("log.enabled")) {
71+
if ($app && $app->config('log.enabled')) {
7272
$app->logger()->error($th);
7373
}
7474

@@ -186,9 +186,12 @@ protected static function exceptionMarkup($title, $body)
186186
*/
187187
public static function defaultDown()
188188
{
189-
echo static::errorMarkup(
190-
'Oops!',
191-
'<p>App is under maintainance, please check back soon.</p>'
189+
(new \Leaf\Http\Response())->exit(
190+
static::errorMarkup(
191+
'Oops!',
192+
'<p>App is under maintainance, please check back soon.</p>'
193+
),
194+
503
192195
);
193196
}
194197

@@ -227,6 +230,9 @@ public static function defaultError($e = null)
227230
}
228231
}
229232

230-
echo self::errorMarkup('Oops!', '<p>A website error has occurred, our team has been notified.</p>');
233+
(new \Leaf\Http\Response())->exit(
234+
self::errorMarkup('Oops!', '<p>A website error has occurred, our team has been notified.</p>'),
235+
500
236+
);
231237
}
232238
}

0 commit comments

Comments
 (0)