Global Error Handler

Topics: Customizing Orchard
Nov 22, 2011 at 11:22 PM

I previously commented on this discussion thread about configuring web.config in Orchard to use a custom 404 page. That works fine, and I even took that further and redirected to a route which allows me to return a themed view.

Now I want to register a global handler for any uncaught exceptions that happen (i.e. 500 errors). I don't want to just redirect 500 errors to another route/page because I want to be able to log or email the error details to someone. Has anyone done this in Orchard, and if so how did you configure it? I looked at this post on Stack Overflow about doing this in MVC3 with a global filter, but I suspect this won't work in Orchard.

This is a fairly common requirement in many web apps, and I did it many times back in my WebForms days. But I haven't done it with Orchard and am curious what others have done.


Nov 23, 2011 at 1:21 AM

It's implemented on the 1.x branch right now, you should be able to import the changes to 1.3 if you need. Look for Suha's changesets lately (bac- ported from dev branch actually).

Nov 23, 2011 at 7:01 PM

Awesome, thanks Sebastien! I'll take a look a look at those changesets. I may not actually need to merge the changes into 1.3 if they're going to be included in 1.4 anyway.