Forums Register Login

controller catches all exceptions:

+Pie Number of slices to send: Send
I think it is controller's responsibility to catch all exceptions.
Models can catch exceptions but must throw it again to the controller,because models should not do control things .
This is "single point of control". Controller catches exceptions and then to some controls.
What do you say??
+Pie Number of slices to send: Send
Well,I think all the M V and C can catch exceptions,and they catch their own exceptions.
+Pie Number of slices to send: Send
 

Originally posted by Nick Lee:
Well,I think all the M V and C can catch exceptions,and they catch their own exceptions.


Hi Nick,
When model catches the exception,there may be something happen to some models or views, if so, who will do this thing? I think modle should not do this thing.
Of course model can catch exceptions and do not throws them again when there is nothing needed to change.
What do you say?
+Pie Number of slices to send: Send
Hi Biang
I think it depends on what the exception is. There are some exceptions that you might want the model to try and recover from itself.
To give an example: If you catch an exception stating that the network connection has died, you might choose to simply try and get a new network connection first, before bothering the client about it.
Of course there are some exceptions that the model cannot recover from, and you might want to let the view handle it.
Regards, Andrew
+Pie Number of slices to send: Send
Hi Andrew ,
Thanks for your comment.I will think about it carefully.
pie. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 583 times.
Similar Threads
A Question of Style: Validating Field Values
Websphere not reporting exceptions
MVC: can the controller handle the TableModel directly ?
RuntimeException in main()
Unchecked Exceptions - Remote v Local ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:51:34.