FlattenException
now unwraps errors¶
Contributed by
Alexander M. Turek
in #26028.
Symfony wraps errors thrown by the application inside a FatalThrowableError
.
This makes the actual error class to not be displayed in the exception pages,
where you see for example Symfony's FatalThrowableError
instead of PHP's
DivisionByZeroError
when your code tries to divide by 0
.
In Symfony 4.1, FlattenException
now unwraps FatalThrowableError
instances and logs the wrapped error. In consequence, the real error class is
now always displayed in the exception page:
Contributed by
Sullivan Senechal
and Florent Mata
in #25775
and #26475.
In Symfony 4.1 we've introduced a new ProcessSignaledException
class in the
Process component to properly catch signaled process errors. Also, in the
HttpFoundation component, we've introduced new detailed exception classes for
file upload handling to replace the generic catch-all FileException
:
1 2 3 4 5 6 7 | use Symfony\Component\HttpFoundation\File\Exception\CannotWriteFileException;
use Symfony\Component\HttpFoundation\File\Exception\ExtensionFileException;
use Symfony\Component\HttpFoundation\File\Exception\FormSizeFileException;
use Symfony\Component\HttpFoundation\File\Exception\IniSizeFileException;
use Symfony\Component\HttpFoundation\File\Exception\NoFileException;
use Symfony\Component\HttpFoundation\File\Exception\NoTmpDirFileException;
use Symfony\Component\HttpFoundation\File\Exception\PartialFileException;
|
Moreover, now that PHP 7.1 supports multi catch exception handling, you can
process several exceptions with the same catch()
block:
1 2 3 4 5 | try {
// ...
} catch (FormSizeFileException | IniSizeFileException $e) {
// ...
}
|
Contributed by
Javier Eguiluz
in #26671.
The exception pages have been improved in Symfony 4.1 to display less information
about "vendor code". If some code belongs to the vendor/
folder, we compact
its information to fit in a single line and we no longer display its arguments.
The other code remains the same, which helps you focus more easily on your own
application code:
What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...