Skip to content
Merged

Wip #54

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/RouterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ public function __construct(string $message = "", int $code = 0, ?Throwable $pre
*/
public function exception_handler(Throwable $exception): void
{
if (Rudra::config()->get("environment") === "development") {
$debugbar = Rudra::get("debugbar");
if ($debugbar && $debugbar->hasCollector('exceptions')) {
$debugbar['exceptions']->addException($exception);
}
}

Redirect::responseCode($exception->getCode());
Router::directCall(Rudra::config()->get("http.errors")[$exception->getCode()]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
use Rudra\Exceptions\RouterException;

if (!function_exists('abort')) {
function abort(int $code): void
function abort(int $code, string $message = ''): void
{
throw new RouterException($code);
throw new RouterException($message ?: "HTTP Error {$code}", $code);
}
}
Loading