Thanks. I had originally tried what was in that example, but it didn't work for me. So I tried it again, and this time it worked.
What I did was just add this
to my error function. You should consider updating your mvc docs to include this snippet in that function.