Billy
Billy

Reputation: 19

Error handling with PHP classes

I'm working on my first "public" class, meaning that i will release it under the GPL for everyone. I'm giving extra-attention to documentation, however, i gave zero attention to error handling. How do you guys suggest that i do that? Throw exceptions? I never worked with error handling before, just the basic try catch with PDO and others.

Upvotes: 2

Views: 239

Answers (1)

jwueller
jwueller

Reputation: 30991

Exceptions are (in general) the most elegant way of error handling. You definitely do not want to use some kind of error-codes, since it requires much more code and effort to check for those.

Upvotes: 4

Related Questions