Closed nathggns closed 11 years ago
Somehow we need to handle exceptions.
I propose a system similar to this.
I propose an exception handler sort of system.
Single Exception
<?php $router->error('ExceptionValidate', function($e) { // ... });
Multiple Exceptions
<?php $router->error(['ExceptionValidate', 'ExceptionRouting'], function($e) { // ... });
All Exceptions
<?php $router->error(true, function($e) { // .. });
Where $e is an object allowing you to decide what to do.
$e
<?php $e->rethrow(); // Re-throw the error. (Eventually this will be catched by the Error class, which is yet to be made. $e->send($val); // Send value. $e->exc // The actual exception
This solves #40.
Also, $e->type for the type of error it was, such as ExceptionRouting.
$e->type
ExceptionRouting
Something to think about: Is the 'true for all exceptions' needed, cause you could just pass Exception?
Exception
Somehow we need to handle exceptions.
I propose a system similar to this.
I propose an exception handler sort of system.
Single Exception
Multiple Exceptions
All Exceptions
Where
$e
is an object allowing you to decide what to do.