As part of my process to upgrade DimeCasts.net to preview 4 I wanted to take advantage of the new HandleErrorAttribute. Out of the box this looked like something that I would want to use and could use very easily. However, I quickly realized that this attribute does not cut it for me.
Why does it not work well for me, I will tell you.
- It is a sealed class which means that I cannot inherit and extend it. Why would it be sealed? Note to MVC team. Avoid sealing classes for 'basic' features.
- By default it wants you to put your error page in the Views/Shared and name the page error.aspx. Now I know there is a way to override this, but it was more painful that I had hoped.
[MyHandleErrorAttribute(View = "~/Views/[folder]/[page].aspx")]
- I was not able it to route to a controller action, only to my view. I tried to get it to route to my controller action (ok, maybe I was doing something wrong... it is possible) but did not have any luck. Even when I could get it to display my view correctly it did not invoke the controller action for me.
All this being said, I am NOT going to switch to using this new attribute as my hand rolled one works better in my opinion and is still getting the job done (right tool for the job right :) ).
I must admit, I am a bit sad that this nice, common feature did not work out for me.
If anyone else has had better luck with this please let me know.
Till next time,
[----- Remember to check out DimeCasts.Net -----]