Beispiel #1
0
        /// <summary>
        /// UI Unhandled Exception Handler
        /// </summary>
        /// <param name="exception"></param>
        public Exception UIExceptionHandler(Exception exception)
        {
            ControllerConfigurator.utilityProvider.GetLogger().LogFatal("Executor.ExecuteProcess", exception);
            JsonException jsonException = ExceptionBag.Get(Constants.WEB_UNHANDLED_EXCEPTIONID.ToString()) as JsonException;

            jsonException.ErrorData = exception.Message;
            throw jsonException;
        }
Beispiel #2
0
        private IController GetExceptionController(FrameworkException exception, ExecutionContext executionContext, ISessionContext sessionContext)
        {
            System.Web.Mvc.Controller controller      = null;
            IExceptionConfig          exceptionConfig = ExceptionBag.Get(exception.ErrorId.ToString());
            object command        = Activator.CreateInstance(typeof(HandledExceptionCommand), exception);
            object resultBuilder  = ActionResultBuilderFactory.Create(exceptionConfig.ResponseType, null);
            Type   controllerType = typeof(Requestor <,>).MakeGenericType(
                new Type[] { typeof(HandledExceptionCommand), typeof(JsonErrorMessage) });
            ISafeBlockProvider safeBlockProvider = ControllerConfigurator.utilityProvider.GetSafeBlockProvider();

            executionContext.SafeActionBlock = safeBlockProvider.Create("UIDefault");
            controller = Activator.CreateInstance(controllerType, executionContext, sessionContext, command, resultBuilder) as System.Web.Mvc.Controller;
            return(controller);
        }
Beispiel #3
0
        /// <summary>
        /// Module Exception Handler
        /// </summary>
        /// <param name="exception"></param>
        public virtual Exception ExceptionHandler(Exception exception)
        {
            string           errorMSG        = ControllerConfigurator.iResourceService.GetLiteral((exception as ModuleException).ErrorCode.ToString());
            IExceptionConfig exceptionConfig = ExceptionBag.Get((exception as ModuleException).ErrorCode.ToString());

            if (exceptionConfig.ResponseType == ResultType.JSON)
            {
                exceptionConfig.ErrorData = exception.Message;
                return(exceptionConfig as JsonException);
            }
            else
            {
                return(exceptionConfig as ViewException);
            }
        }
Beispiel #4
0
 public override JsonErrorMessage Get(IExecutionContext executionCtx, ISessionContext sessionCtx)
 {
     executionCtx.ResponseHeader.Add(Constants.EXCEPTIONHEADER, "JSON");
     if (frameworkException != null)
     {
         IExceptionConfig exceptionConfig  = ExceptionBag.Get(frameworkException.ErrorId.ToString());
         JsonErrorMessage exceptionMessage = new JsonErrorMessage()
         {
             Message = frameworkException.ErrorMessage, ActionCommand = (exceptionConfig as JsonException).ActionConfig
         };
         return(exceptionMessage);
     }
     else
     {
         throw new System.Exception("Exception Configuration not found");
     }
 }