Reputation: 662
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!
Upvotes: 3
Views: 232
Reputation: 532625
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.
Upvotes: 2
Reputation: 6069
agreed. Model should be happy to throw up stuff as long as it is generated from information readily available to the model.
Upvotes: 3
Reputation: 10685
I would expect the model to throw an exception which can be handled by the view (and presented the the end user if appropriate).
Upvotes: 3