protected virtual void TryHandleBoltServerError(ClientActionContext context) { if (!context.Response.IsSuccessStatusCode) { BoltServerException boltError = ErrorProvider.TryReadServerError(context); if (boltError != null) { throw boltError; } } }
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); }
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); } }
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); } }
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); }