I have just downloaded the CTP bits and started playing with MVC. I've noticed that exceptions occurring during the execution of an action are delegated to the OnError method which we can override in order to handle them. What is this method supposed to
return? Returning "true" propagates the exception otherwise the exception is handled which IMHO is misleading. Is this the expected behavior?
Currently, the semantic is return true if you want the error to propagate. Not exacty very clear, I know. This will be changed in a future revision. Rather than returning bool, we'll probably go with some sort of args approach so you have more context to
make a decision within that method.
Phil Haack (http://haacked.com/)
Senior Program Manager, Microsoft
What wouldn’t you do for a Klondike bar?
Marked as answer by dimitrod on Dec 10, 2007 07:43 PM
dimitrod
Member
102 Points
27 Posts
Return value of Controller.OnError
Dec 10, 2007 02:13 PM|LINK
I have just downloaded the CTP bits and started playing with MVC. I've noticed that exceptions occurring during the execution of an action are delegated to the OnError method which we can override in order to handle them. What is this method supposed to return? Returning "true" propagates the exception otherwise the exception is handled which IMHO is misleading. Is this the expected behavior?
Regards,
Darin
Haacked
Contributor
6901 Points
412 Posts
Re: Return value of Controller.OnError
Dec 10, 2007 03:46 PM|LINK
Currently, the semantic is return true if you want the error to propagate. Not exacty very clear, I know. This will be changed in a future revision. Rather than returning bool, we'll probably go with some sort of args approach so you have more context to make a decision within that method.
Senior Program Manager, Microsoft
What wouldn’t you do for a Klondike bar?
CVertex
Member
147 Points
128 Posts
Re: Return value of Controller.OnError
Dec 10, 2007 10:06 PM|LINK
I concur that the return type is not self explanatory.
The EventArgs solution is way better.