protected virtual void TryHandleBoltServerError(ClientActionContext context)
 {
     if (!context.Response.IsSuccessStatusCode)
     {
         BoltServerException boltError = ErrorProvider.TryReadServerError(context);
         if (boltError != null)
         {
             throw boltError;
         }
     }
 }
Beispiel #2
0
        protected virtual void HandleBoltServerError(ServerActionContext actionContext, BoltServerException error)
        {
            int statusCode = 500;

            var response = actionContext.HttpContext.Response;
            response.StatusCode = statusCode;
            if (error.ErrorCode != null)
            {
                response.Headers[actionContext.Configuration.Options.ServerErrorHeader] = error.ErrorCode.Value.ToString(CultureInfo.InvariantCulture);
            }
            else if (error.Error != null)
            {
                response.Headers[actionContext.Configuration.Options.ServerErrorHeader] = error.Error.Value.ToString();
            }

            LogBoltServerError(actionContext, error);
        }
Beispiel #3
0
        private void LogBoltServerError(ServerActionContext context, BoltServerException error)
        {
            if (error.ServerError != null)
            {
                Logger.LogError(
                    BoltLogId.RequestExecutionError,
                    "Execution of '{0}' failed with Bolt error '{1}'",
                    context.Action.Name,
                    error.ServerError);
            }

            if (error.ErrorCode != null)
            {
                Logger.LogError(
                    BoltLogId.RequestExecutionError,
                    "Execution of '{0}' failed with error code '{1}'",
                    context.Action.Name,
                    error.ErrorCode);
            }
        }
Beispiel #4
0
        private void LogBoltServerError(ServerActionContext context, BoltServerException error)
        {
            if (error.Error != null)
            {
                Logger.LogError(
                    BoltLogId.RequestExecutionError,
                    "Execution of '{0}' failed with Bolt error '{1}'",
                    context.Action.Name,
                    error.Error);
            }

            if (error.ErrorCode != null)
            {
                Logger.LogError(
                    BoltLogId.RequestExecutionError,
                    "Execution of '{0}' failed with error code '{1}'",
                    context.Action.Name,
                    error.ErrorCode);
            }
        }
Beispiel #5
0
        protected virtual void HandleBoltServerError(ServerActionContext actionContext, BoltServerException error)
        {
            int statusCode = 500;

            var response = actionContext.HttpContext.Response;

            response.StatusCode = statusCode;
            if (error.ErrorCode != null)
            {
                response.Headers[actionContext.Configuration.Options.ServerErrorHeader] = error.ErrorCode.Value.ToString(CultureInfo.InvariantCulture);
            }
            else if (error.ServerError != null)
            {
                response.Headers[actionContext.Configuration.Options.ServerErrorHeader] = error.ServerError.Value.ToString();
            }

            LogBoltServerError(actionContext, error);
        }