Let's say I have an object that represents some table. You create an empty version of the object, and populate the values individually, then call:
Which will validate all the fields you set, and if all is well, insert object to table.
What I want is a good way for calling functions to be told why add() might fail.
If all is good, I want it to return true ideally, since that's standard behaviour for a function, otherwise, return an array of errors. But that would also evaluate to true.
I'm wondering if there is some way of emulating an exception with this? Or is there a good way to return true on success, false otherwise and have an error list?