Error handling

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matt1234
Forum Commoner
Posts: 44
Joined: Wed Nov 26, 2008 9:43 pm

Error handling

Post by matt1234 »

I'm designing a PHP site from scratch and I want to know the best way to handle errors. I put together a function that becomes PHP's new go-to error-handling function but I've run across the idea...what if that function hiccups? How can I print a friendly error message if my error-handling function hiccups?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Error handling

Post by social_experiment »

I'd go with exceptions, check what can cause the functions to fail and throw an exception based on that.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply