Skip to content

Commit

Permalink
Merge pull request #2 from ibnsultan/patch-1
Browse files Browse the repository at this point in the history
Http error codes for 404 and client Error - 400
  • Loading branch information
mychidarko authored Mar 5, 2024
2 parents 313a113 + 947b863 commit cd5aea6
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 @@ -200,9 +200,12 @@ public static function defaultDown()
*/
public static function default404()
{
echo static::errorMarkup(
'404',
'<p>The page you are looking for could not be found.</p>'
(new \Leaf\Http\Response())->exit(
static::errorMarkup(
'404',
'<p>The page you are looking for could not be found.</p>'
),
404
);
}

Expand All @@ -211,9 +214,12 @@ public static function default404()
*/
public static function csrf($error = null)
{
echo static::errorMarkup(
'Invalid request',
"<p>$error</p>" ?? '<p>The page you are looking for has expired.</p>'
(new \Leaf\Http\Response())->exit(
static::errorMarkup(
'Invalid request',
"<p>$error</p>" ?? '<p>The page you are looking for has expired.</p>'
),
400
);
}

Expand Down

0 comments on commit cd5aea6

Please sign in to comment.