-
Notifications
You must be signed in to change notification settings - Fork 55
Description
What
We should review the current usage of throw * and (when appropriate) handle the error or return WP_Error objects instead.
Why
To butcher the whole "Exceptions should be exceptional" argument, using Exceptions for control flow is an antipattern (in most places but especially ) in WordPress-land.
While in some cases, throwing may be the optimal way to centralize and "abstract" our error handling, more often it leads to try {} catch {} pollution additional doc requirements, and overall more dx complication - especially in the WordPress crowd.
How
Starting top level (WP/MCP/Core) and working inwards, we review where we can directly return a new WP_Error() (and what try-catches we can remove as a result ). This should allow us to review and remediate things incrementally without worrying about disrupting the existing lifecycle while still help prevent us leaking new exceptions in future commits.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status