mirror of
https://github.com/getformwork/formwork.git
synced 2025-02-22 16:56:50 +01:00
Merge pull request #124 from getformwork/feature/optional-error-handlers
Add the possibility to not set error handlers for debugging
This commit is contained in:
commit
a577a81f7f
@ -36,6 +36,9 @@ return [
|
||||
'timezone' => 'UTC',
|
||||
'week_starts' => 0
|
||||
],
|
||||
'errors' => [
|
||||
'set_handlers' => true
|
||||
],
|
||||
'files' => [
|
||||
'allowed_extensions' => [
|
||||
'.jpg',
|
||||
|
@ -279,11 +279,13 @@ final class Admin
|
||||
*/
|
||||
protected function loadErrorHandler(): void
|
||||
{
|
||||
$this->errors = new Controllers\ErrorsController();
|
||||
set_exception_handler(function (Throwable $exception): void {
|
||||
$this->errors->internalServerError($exception)->send();
|
||||
throw $exception;
|
||||
});
|
||||
if (Formwork::instance()->config()->get('errors.set_handlers')) {
|
||||
$this->errors = new Controllers\ErrorsController();
|
||||
set_exception_handler(function (Throwable $exception): void {
|
||||
$this->errors->internalServerError($exception)->send();
|
||||
throw $exception;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,11 +94,10 @@ final class Formwork
|
||||
{
|
||||
$this->initializeSingleton();
|
||||
|
||||
Errors::setHandlers();
|
||||
|
||||
$this->request = Uri::removeQuery(HTTPRequest::uri());
|
||||
|
||||
$this->loadConfig();
|
||||
$this->loadErrorHandlers();
|
||||
$this->loadLanguages();
|
||||
$this->loadTranslations();
|
||||
$this->loadSchemes();
|
||||
@ -225,6 +224,16 @@ final class Formwork
|
||||
date_default_timezone_set($this->config->get('date.timezone'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load error handlers
|
||||
*/
|
||||
protected function loadErrorHandlers(): void
|
||||
{
|
||||
if ($this->config()->get('errors.set_handlers')) {
|
||||
Errors::setHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load language from request
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user