tags:

views:

68

answers:

3

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!

+3  A: 

I would expect the model to throw an exception which can be handled by the view (and presented the the end user if appropriate).

mopoke
+3  A: 

agreed. Model should be happy to throw up stuff as long as it is generated from information readily available to the model.

piggles
It's important to add though, that all the information that is needed to deal with the error should be passed with the error.
piggles
+1  A: 

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.

tvanfosson