public LoggingSessionAttribute(
     IActionLogHelper actionLogHelper, 
     IActionExceptionHandler actionExceptionHandler)
 {
     _actionLogHelper = actionLogHelper;
     _actionExceptionHandler = actionExceptionHandler;
 }
 public LoggingSessionAttribute(
     IActionLogHelper actionLogHelper,
     IActionExceptionHandler actionExceptionHandler)
 {
     _actionLogHelper        = actionLogHelper;
     _actionExceptionHandler = actionExceptionHandler;
 }
 public AuthorizationFilter(IAuthorizationService authorizationService,
                            IActionExceptionHandler actionResultFactory,
                            IOptions <AspNetAuthorizationOptions> options)
 {
     this.authorizationService = authorizationService;
     this.actionResultFactory  = actionResultFactory;
     this.options = options;
 }
 public LoggingNHibernateSessionAttribute(
     IActionLogHelper actionLogHelper,
     IActionExceptionHandler actionExceptionHandler,
     IActionTransactionHelper actionTransactionHelper)
 {
     _actionLogHelper = actionLogHelper;
     _actionExceptionHandler = actionExceptionHandler;
     _actionTransactionHelper = actionTransactionHelper;
 }
 public LoggingNHibernateSessionAttribute(
     IActionLogHelper actionLogHelper,
     IActionExceptionHandler actionExceptionHandler,
     IActionTransactionHelper actionTransactionHelper)
 {
     _actionLogHelper         = actionLogHelper;
     _actionExceptionHandler  = actionExceptionHandler;
     _actionTransactionHelper = actionTransactionHelper;
 }
        private void ProcessErrorResponse(Exception ex, ref SocketRequest request)
        {
            string msg = ex.Message;

            if (ex.InnerException != null)
            {
                msg += $" {ex.InnerException.Message}";
            }

            if (telemetry != null)
            {
                telemetry.Collect(new ActionError(controllerName, actionName, msg));
            }

            if (request != null)
            {
                ServerAction serverAction = method.GetCustomAttribute <ServerAction>();
                if (serverAction == null)
                {
                    request.ProcessResponse(ActionResult.Json("", ResponseStatus.ERROR, $"Process request error: {msg}"), clientSocket, null);
                }
                else
                {
                    int errorCode = (serverAction.DefaultErrorCode == 0
                        ? ResponseStatus.ERROR
                        : serverAction.DefaultErrorCode);

                    if (serverAction.ExceptionHandler == null)
                    {
                        request.ProcessResponse(ActionResult.Json("", errorCode, $"Process request error: {msg}"), clientSocket, null);
                    }
                    else
                    {
                        IActionExceptionHandler handler = (IActionExceptionHandler)
                                                          Activator.CreateInstance(serverAction.ExceptionHandler);
                        ActionResult result = ActionResult.Json(handler.Handle(ex, request), 600, "Request error, but handled by application");
                        request.ProcessResponse(result, clientSocket, null);
                    }
                }
            }
        }
Exemple #7
0
 public ExceptionFilter(IActionExceptionHandler resultHandler)
 {
     this.resultHandler = resultHandler;
 }