Welcome Guest, Not a member yet? Register   Sign In
error handling in model
#1

[eluser]webscriptz.be[/eluser]
Because the model is basically the 'place to be' when it comes to process logic i should also be the please to be to alert for errors or is this for controllers ?

can i or can't i do show_error() in a model?
#2

[eluser]TheFuzzy0ne[/eluser]
I don't think there's anything stopping you, but I think that technically, your model shouldn't do anything other than return data.
#3

[eluser]Mackstar[/eluser]
I wouldn't agree that the model is only for returning data. It is for processing data, hence if you use the model to trigger your errors like in Java's try catch throw exception thinking then models are a good place for this, however php is a little more limited than Java in this regard unless you design it that way. If you have data related errors written to logs then the model is also good. But to be truly mvc the actual showing of your errror needs to be handled by controller/view.
#4

[eluser]webscriptz.be[/eluser]
[quote author="Mackstar" date="1238564220"]I wouldn't agree that the model is only for returning data. It is for processing data, hence if you use the model to trigger your errors like in Java's try catch throw exception thinking then models are a good place for this, however php is a little more limited than Java in this regard unless you design it that way. If you have data related errors written to logs then the model is also good. But to be truly mvc the actual showing of your errror needs to be handled by controller/view.[/quote]

I see reason in this answer Mackstar, models give data - get and proces data so the easiest would be returning false in case of errors.




Theme © iAndrew 2016 - Forum software by © MyBB