Catch errors

This commit is contained in:
Maarten 2019-12-24 00:43:19 +01:00
parent df52bab204
commit cc9856ad39
3 changed files with 8 additions and 4 deletions

View file

@ -2,6 +2,7 @@
namespace Runtime\Http\Input;
use Runtime\Exceptions\ExceptionHandler;
use Runtime\Exceptions\Exceptions\InvalidArgumentException;
use Runtime\Http\Request;
@ -81,7 +82,7 @@ class InputHandler
try {
$list[$key] = InputFile::createFromArray($values + $value);
} catch (InvalidArgumentException $e) {
ExceptionHandler::make($e);
}
continue;
}
@ -139,7 +140,7 @@ class InputHandler
continue;
} catch (InvalidArgumentException $e) {
ExceptionHandler::make($e);
}
}

View file

@ -79,7 +79,7 @@ class Route
$routerOutput = ob_get_contents();
ob_end_clean();
} catch (\Exception $e) {
ExceptionHandler::make($e);
}
// Try to parse library version

View file

@ -2,6 +2,7 @@
namespace Runtime\Router;
use Runtime\Exceptions\ExceptionHandler;
use Runtime\Exceptions\Exceptions\InvalidArgumentException;
use Runtime\Exceptions\Exceptions\MalformedUrlException;
use Runtime\Http\Middleware\BaseCsrfVerifier;
@ -130,6 +131,7 @@ class Router
$this->request = new Request();
} catch (MalformedUrlException $e) {
$this->debug(sprintf('Invalid request-uri url: %s', $e->getMessage()));
ExceptionHandler::make($e);
}
$this->routes = [];
@ -481,6 +483,7 @@ class Router
*/
protected function handleException(\Exception $e): ?string
{
$this->debug('Starting exception handling for "%s"', \get_class($e));
$this->fireEvents(EventHandler::EVENT_LOAD_EXCEPTIONS, [
@ -531,7 +534,7 @@ class Router
}
} catch (\Exception $e) {
ExceptionHandler::make($e);
}
$this->debug('Finished processing');