So today, I instigated a lively discussion on the topic of WP_Error
vs PHP Exceptions.
A great deal of discussion later, I have some great resources compiled and a summary:
- Peter Baylies provided this link to a WordPress trac ticket discussing this issue, as well as a link to Ryan McCue’s post about his distaste for the use of WP_Error from almost 3 years ago.
- Ryan also posted it on wordpress-hackers for more discussion.
- As the lead WordPress Lead Developer, I was particularly interested in what Andrew Nacin had to say.
- Mario Y. Peshev, Coen Jacobs, and Andrew Nacin all pitched in and provided some great feedback.
- As Twitter is wont to do, the conversation became a bit fractured, but Andrey Savchenko joined and this conversation branch is also helpful.
For me, the most helpful takeaway (and the TL;DR) would be this response from Andrew Nacin:
As always, I’m exceedingly thankful for those who take time out of their day to respond on twitter. I always learn a ton! Hopefully you’ll find this post helpful if you’re researching or curious about the issue like I was.