Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

controller catches all exceptions:

 
biang lin
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Nick Lee
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well,I think all the M V and C can catch exceptions,and they catch their own exceptions.
 
biang lin
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
biang lin
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew ,
Thanks for your comment.I will think about it carefully.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic