Skip to content

Commit

Permalink
fix: patch up error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Aug 13, 2023
1 parent 064a24f commit 313a113
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Exception/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static function handleErrors($errno, $errstr = '', $errfile = '', $errlin
try {
throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
} catch (\Throwable $th) {
$app = \Leaf\Config::get("app")["instance"];
$app = \Leaf\Config::get('app')['instance'];

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

Expand Down Expand Up @@ -186,9 +186,12 @@ protected static function exceptionMarkup($title, $body)
*/
public static function defaultDown()
{
echo static::errorMarkup(
'Oops!',
'<p>App is under maintainance, please check back soon.</p>'
(new \Leaf\Http\Response())->exit(
static::errorMarkup(
'Oops!',
'<p>App is under maintainance, please check back soon.</p>'
),
503
);
}

Expand Down Expand Up @@ -227,6 +230,9 @@ public static function defaultError($e = null)
}
}

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

0 comments on commit 313a113

Please sign in to comment.