Ejemplo n.º 1
0
 public static bool HandleStoreFrontInactiveException(StoreFrontInactiveException ex, bool clearError, HttpContext context, RouteData routeData, BaseController controller)
 {
     string rawUrl = context.Request.RawUrl;
     string url = context.Request.Url.ToString();
     if (Settings.AppLogSystemEventsToDb || Settings.AppLogSystemEventsToFile)
     {
         LogFileNotFound(ex, context, routeData, controller);
     }
     if (Settings.AppUseFriendlyErrorPages)
     {
         ShowErrorPage(ErrorPage.Error_GStoreInactive, (int)HttpStatusCode.OK, ex, clearError, context, controller);
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
        protected virtual void ExceptionHandler(ExceptionContext filterContext)
        {
            if (!filterContext.ExceptionHandled)
            {
                if (filterContext.Exception.GetBaseException() is DynamicPageInactiveException)
                {
                    DynamicPageInactiveException exDPI = filterContext.Exception.GetBaseException() as DynamicPageInactiveException;
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleDynamicPageInactiveException(exDPI, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception.GetBaseException() is DynamicPageNotFoundException)
                {
                    DynamicPageNotFoundException exDPNF = filterContext.Exception.GetBaseException() as DynamicPageNotFoundException;
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleDynamicPageNotFoundException(exDPNF, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception.GetBaseException() is NoMatchingBindingException)
                {
                    NoMatchingBindingException exNMB = filterContext.Exception.GetBaseException() as NoMatchingBindingException;
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleNoMatchingBindingException(exNMB, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception.GetBaseException() is StoreFrontInactiveException)
                {
                    StoreFrontInactiveException exSFI = filterContext.Exception.GetBaseException() as StoreFrontInactiveException;
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleStoreFrontInactiveException(exSFI, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception is HttpCompileException || filterContext.Exception.GetBaseException() is HttpCompileException)
                {
                    HttpCompileException httpCompileEx = null;
                    if (filterContext.Exception is HttpCompileException)
                    {
                        httpCompileEx = filterContext.Exception as HttpCompileException;
                    }
                    else
                    {
                        httpCompileEx = filterContext.Exception.GetBaseException() as HttpCompileException;
                    }
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleHttpCompileException(httpCompileEx, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception is HttpParseException || filterContext.Exception.GetBaseException() is HttpParseException)
                {
                    HttpParseException httpParseEx = null;
                    if (filterContext.Exception is HttpCompileException)
                    {
                        httpParseEx = filterContext.Exception as HttpParseException;
                    }
                    else
                    {
                        httpParseEx = filterContext.Exception.GetBaseException() as HttpParseException;
                    }
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleHttpParseException(httpParseEx, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception is HttpException || filterContext.Exception.GetBaseException() is HttpException)
                {
                    HttpException httpEx = null;
                    if (filterContext.Exception is HttpException)
                    {
                        httpEx = filterContext.Exception as HttpException;
                    }
                    else
                    {
                        httpEx = filterContext.Exception.GetBaseException() as HttpException;
                    }
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleHttpException(httpEx, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception is ApplicationException)
                {
                    ApplicationException appEx = filterContext.Exception as ApplicationException;
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleAppException(appEx, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }
                else if (filterContext.Exception is InvalidOperationException || filterContext.Exception.GetBaseException() is InvalidOperationException)
                {
                    InvalidOperationException ioEx = null;
                    if (filterContext.Exception is InvalidOperationException)
                    {
                        ioEx = filterContext.Exception as InvalidOperationException;
                    }
                    else
                    {
                        ioEx = filterContext.Exception.GetBaseException() as InvalidOperationException;
                    }
                    filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleInvalidOperationException(ioEx, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                    return;
                }

                //Unknown exception handler
                //exceptions that are expected or common should hit the above exception handlers.
                Exception ex = filterContext.Exception;
                filterContext.ExceptionHandled = Exceptions.ExceptionHandler.HandleUnknownException(ex, false, filterContext.HttpContext.ApplicationInstance.Context, RouteData, this);
                return;
            }
        }