Posted on April 2, 2015
So today, I instigated a lively discussion on the topic of
WP_Error vs PHP Exceptions.
I’m curious why try/catch exceptions are rarely used in WP dev? Any insight?
— Justin Sternberg (@Jtsternberg) April 2, 2015
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.
- 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:
— Andrew Nacin (@nacin) April 2, 2015
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.