private Task ProcessResponse(StateChangeTracker tracker, object result, HubRequest request, Exception error) { var exception = error.Unwrap(); string stackTrace = (exception != null && _isDebuggingEnabled) ? exception.StackTrace : null; string errorMessage = exception != null ? exception.Message : null; if (exception != null) { _counters.ErrorsHubInvocationTotal.Increment(); _counters.ErrorsHubInvocationPerSec.Increment(); _counters.ErrorsAllTotal.Increment(); _counters.ErrorsAllPerSec.Increment(); } var hubResult = new HubResponse { State = tracker.GetChanges(), Result = result, Id = request.Id, Error = errorMessage, StackTrace = stackTrace }; return(Transport.Send(hubResult)); }
private Task ProcessResponse(StateChangeTracker tracker, object result, HubRequest request, Exception error) { var hubResult = new HubResponse { State = tracker.GetChanges(), Result = result, Id = request.Id, }; if (error != null) { _counters.ErrorsHubInvocationTotal.Increment(); _counters.ErrorsHubInvocationPerSec.Increment(); _counters.ErrorsAllTotal.Increment(); _counters.ErrorsAllPerSec.Increment(); if (_enableDetailedErrors) { var exception = error.InnerException ?? error; hubResult.StackTrace = _isDebuggingEnabled ? exception.StackTrace : null; hubResult.Error = exception.Message; } else { hubResult.Error = String.Format(CultureInfo.CurrentCulture, Resources.Error_HubInvocationFailed, request.Hub, request.Method); } } return(Transport.Send(hubResult)); }
protected override ClientHubInvocation GetInvocationData(string method, object[] args) { return(new ClientHubInvocation { Hub = HubName, Method = method, Args = args, State = _tracker.GetChanges() }); }
private Task SendProgressUpdate(string connectionId, StateChangeTracker tracker, object value, HubRequest request) { var hubResult = new HubResponse { State = tracker.GetChanges(), Progress = new { I = request.Id, D = value }, // We prefix the ID here to ensure old clients treat this as a hub response // but fail to lookup a corresponding callback and thus no-op Id = "P|" + request.Id, }; return(Connection.Send(connectionId, hubResult)); }
private Task ProcessResponse(StateChangeTracker tracker, object result, HubRequest request, Exception error) { var hubResult = new HubResponse { State = tracker.GetChanges(), Result = result, Id = request.Id, }; if (error != null) { _counters.ErrorsHubInvocationTotal.Increment(); _counters.ErrorsHubInvocationPerSec.Increment(); _counters.ErrorsAllTotal.Increment(); _counters.ErrorsAllPerSec.Increment(); var hubError = error.InnerException as HubException; if (_enableDetailedErrors || hubError != null) { var exception = error.InnerException ?? error; hubResult.StackTrace = _isDebuggingEnabled ? exception.StackTrace : null; hubResult.Error = exception.Message; if (hubError != null) { hubResult.IsHubException = true; hubResult.ErrorData = hubError.ErrorData; } } else { hubResult.Error = String.Format(CultureInfo.CurrentCulture, Resources.Error_HubInvocationFailed, request.Hub, request.Method); } } Trace.TraceVerbose("Sending hub invocation result to connection {0} using transport {1}", Transport.ConnectionId, Transport.GetType().Name); return(Transport.Send(hubResult)); }