Answer the question
In order to leave comments, you need to log in
Why modern frameworks refuse recoverable error?
Actually the question is in the title.
In native php, calling a function, for example, trigger_error('My non-critical error') will cause this information to be saved to the log and processed by all sorts of handlers, including external types newrelic. Moreover, if I do not manually call this function with E_USER_ERROR, the program will continue to run (again, according to the php documentation). But if we take a framework (Yii1/2, Laravel), then we will see that the creation of errors like E_USER_NOTICE/E_USER_WARNING will already cause the application to terminate. Those. not only did they throw out the revoverable error class, they also changed the behavior of the standard php function.
A simple example of why recoverable errors are needed:
There is a service in the vacuum of sending SMS to which two gateways are connected (main and spare). The failure to connect to the primary gateway and send through the alternate is a recoverable error as there was no denial of service. Failure of both gateways is already a critical error.
So, in modern frameworks, I can no longer just throw myself a recoverable error and have to fence the garden just to monitor the fact of the failure of the main gateway.
Question one: why did they do this?
Sorry, it got a little burnt.
Answer the question
In order to leave comments, you need to log in
try/catch?
In PHP7, it seems like they cut out warnings and errors, they are now all exceptions.
php.net/manual/en/language.errors.php7.php
that generating errors like E_USER_NOTICE/E_USER_WARNING will already cause the application to terminate.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question