From dea2feb7f179c6d6a6e4cae45c97d353ae1f57cb Mon Sep 17 00:00:00 2001 From: mychidarko Date: Sat, 14 Dec 2024 11:49:35 +0000 Subject: [PATCH] feat: add a generic error --- src/Exception/General.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Exception/General.php b/src/Exception/General.php index 53b411dd..6dfc50d8 100755 --- a/src/Exception/General.php +++ b/src/Exception/General.php @@ -217,12 +217,26 @@ public static function csrf($error = null) (new \Leaf\Http\Response())->exit( static::errorMarkup( 'Invalid request', - "

$error

" ?? '

The page you are looking for has expired.

' + $error ? "

$error

" : '

The page you are looking for has expired.

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

$message

" + ), + $code + ); + } + /** * Default Error handler */