1
vote
3answers
224 views

Exception when logging exception: is it correct to ignore them?

My question is specific to php, but i think it can be useful in other languages. I log into a table all the exception a code can throw: try{ //Some code } catch (Exception $e) { $log = new ...
3
votes
2answers
388 views

Best way to throw exception and avoid code duplication

I am currently writing code and want to make sure all the params that get passed to a function/method are valid. Since I am writing in PHP I don't have access to all the facilities of other languages ...
2
votes
3answers
2k views

Best method in PHP for the Error Handling ? Convert all PHP errors (warnings notices etc) to exceptions?

What is the best method in PHP for the Error Handling ? is there a way in PHP to Convert all PHP errors (warnings notices etc) to exceptions ? what the best way/practise to error handling ? ...
15
votes
5answers
4k views

should I throw exception from constructor?

I know I can throw exception from constructor in PHP but should I do it? For example, if a parameter's value is not as I expected it. Or should I defer throwing an exception till a method is invoked. ...