Or should error messages be handled in the view? I usually try to just send true and false from my models.
Great to hear what you guys do!
Or should error messages be handled in the view? I usually try to just send true and false from my models.
Great to hear what you guys do!
I would expect the model to throw an exception which can be handled by the view (and presented the the end user if appropriate).
agreed. Model should be happy to throw up stuff as long as it is generated from information readily available to the model.
My models handle validation by throwing an exception when being persisted. The validation logic will collect a set of validation errors, including messages. If there are any validation errors, an exception is thrown. Views/controllers can interrogate the model to find the appropriate error messages if desired.