
The Assertion Handling project is the beginning of a larger revision to how errors are handled which is the subject of this ticket - essentially it is just the Assertion Handler of this system so that it might squeak into the 8.0.x branch and get assertion additions underway as soon as possible.
This project has the larger goal of smoothing out how errors are handled in Drupal with a complete object oriented replacement. /core/includes/errors.inc will be replaced by the classes of this project which will live in core/lib/Drupal/Core/Errors.
The Well Formed Errors Initiative outlines much of what I wish to accomplish here, but a brief recap.
- Error Strings will be formalized to error string codes that map to yaml files with complete explanations of the errors and when possible links to relevant documentation.
- No more white screens of doom
- Begin the use of assert to maintain and document required program state so developers are warned when their new module's configuration file is invalid.
- Reintroduce trigger_error to throw E_USER_DEPRECATED notices where appropriate.
Specific to this project are these additions:
- Allow the developer to configure Drupal to use their favorite error handling system, though Whoops will be the default.
- Error configuration will be in htaccess via SetEnv so that it can be setup immediately after the autoloader is included and before the Drupal Kernal is loaded and main runtime boot comes into play. This will allow for all possible errors in drupal to be handled outside the autoloader, index.php and ErrorSystem class files.
- Allow the developer to log errors to the filesystem instead of or in addition to the database (useful since database connectivity can be lost)
- Simplify error handling as much as possible, and set this system to lazy load as much as possible for minimum overhead.
- Allow errors to be sent to the js console instead of being displayed inline.
- Provide a method to trace and dump, either through Whoops or symfony/vardumper
In short, make Drupal's crashes become the gentlest in the PHP ecosystem instead of the cryptic What the?? monstrosities they sometimes are now.
If this project is accepted and work begins on it then it will affect all developers profoundly - so commentary and input are requested. Later this week I'm going to draw up the class map proposal for this and begin the design of the API.
About the only module that will care alot about this system is devel, but I need to take a look at it and see if any parts of it could be or should be ported to core as part of this project.
Comments
Comment #1
dqdAwesome round-up https://www.drupal.org/node/2412507. Thanks Aki Tenko.
Comment #2
Aki Tendo CreditAttribution: Aki Tendo commentedNew Title.
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #19
smustgrave CreditAttribution: smustgrave at Mobomo commentedSince there's been no follow up and as a feature request going to close out. Can always be re-opened
Thanks all!