private void OnError(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
if (!IsMonoRailRequest(app.Context)) return;
IRailsEngineContext mrContext = ObtainContextFromApplication(sender);
mrContext.LastException = mrContext.UnderlyingContext.Server.GetLastError();
container.extensionManager.RaiseUnhandledError(mrContext);
}