All Questions
4 questions
3
votes
6
answers
164
views
How can I change my code to display information about failure of creation of a value object, when I want to process an array of such objects?
Consider class Crate that is a value object. Crate represents a valid 3-dimensional box.
In constructor I validate the given parameters, and I throw an exception, if supplied dimension parameters ...
2
votes
4
answers
1k
views
Where should PDOExceptions be dealt with?
I wrote a database wrapper class to help with queries and I'm trying to figure the best way to implement try-catch blocks.
In my database class, I have a helper function;
public function fetchAll($...
50
votes
5
answers
26k
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. ...