Skip to content

Commit

Permalink
feat: add a generic error
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Dec 14, 2024
1 parent e5bf7d5 commit dea2feb
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Exception/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,26 @@ public static function csrf($error = null)
(new \Leaf\Http\Response())->exit(
static::errorMarkup(
'Invalid request',
"<p>$error</p>" ?? '<p>The page you are looking for has expired.</p>'
$error ? "<p>$error</p>" : '<p>The page you are looking for has expired.</p>'
),
400
);
}

/**
* Generic error page
*/
public static function error($title, $message, $code = 500)
{
(new \Leaf\Http\Response())->exit(
static::errorMarkup(
$title,
"<p>$message</p>"
),
$code
);
}

/**
* Default Error handler
*/
Expand Down

0 comments on commit dea2feb

Please sign in to comment.