private void ServiceManager_ServiceError(object sender, ServiceErrorEventArgs args) { if (this.services.Contains(args.Error.Service)) { this.metaStrategyBase.SetServiceError(args); } }
protected internal virtual void OnServiceError(ServiceErrorEventArgs e) { if (ServiceError != null) { ServiceError(this, e); } }
private ServiceErrorEventArgs OnException(Exception exception, string transactionCode, string request, string response, bool asyncMode) { var args = new ServiceErrorEventArgs(exception is WebException ? ErrorType.NetworkException : ErrorType.ClientException, string.Empty, exception.Message, transactionCode, request, response, exception, asyncMode); if (!asyncMode && Error != null) { Error(null, args); } return(args); }
private ServiceErrorEventArgs OnError(int statusCode, string errorMessage, string transactionCode, string request, string response, bool asyncMode) { var args = new ServiceErrorEventArgs(ErrorType.ServerError, statusCode.ToString(), errorMessage, transactionCode, request, response, null, asyncMode); if (!asyncMode && Error != null) { Error(null, args); } return(args); }
private void serviceInvoker_Error(object sender, ServiceErrorEventArgs e) { if (!this.SuppressError) { ServiceFactory.NotifyError(sender, e); } else if (this.ThrowException) { throw e.Exception != null ? e.Exception : new ZeboneException(e.ErrorMessage); } }
/// <summary> /// Handles service error event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Event data.</param> /// <exception cref="ArgumentNullException">e is null.</exception> protected override void OnServiceError(object sender, ServiceErrorEventArgs e) { if (e == null) { throw new ArgumentNullException("e", Resources.ArgumentNullException); } base.OnServiceError(sender, e); IncreaseErrorCount(e.DaemonName); UpdateList(false); UpdateProcessesToRun(e.QueuedProcesses); UpdateRunningProcesses(); }
/// <summary> /// Formats message. /// </summary> /// <param name="serviceErrorEventArgs">Message.</param> /// <returns>Formatted message.</returns> /// <exception cref="ArgumentNullException">serviceErrorEventArgs is null.</exception> public string Format(ServiceErrorEventArgs serviceErrorEventArgs) { if (serviceErrorEventArgs == null) { throw new ArgumentNullException("serviceErrorEventArgs", Resources.ArgumentNullException); } FaultException <DefaultFault> faultException = serviceErrorEventArgs.Exception as FaultException <DefaultFault>; // Format service fault. if (faultException != null) { // Check for null. if (faultException.Detail != null) { return(String.Format(CultureInfo.CurrentCulture, @Resources.MessageServiceError, @DateTime.Now, @Resources.MessageTypeError, @serviceErrorEventArgs.DaemonName, @serviceErrorEventArgs.Id, @faultException.Detail.Severity, @faultException.Detail.ErrorCode, @faultException.Detail.Message, @faultException.Detail.Id)); } // Null-data. return(String.Format(CultureInfo.CurrentCulture, @Resources.MessageServiceError, @DateTime.Now, @Resources.MessageTypeError, @serviceErrorEventArgs.DaemonName, @serviceErrorEventArgs.Id, FileWatcherServiceContract.Properties.Resources.SeverityError, @Resources.MessageServiceErrorDataIsMissing, 0, Guid.Empty)); } // Format other exceptions. return(String.Format(CultureInfo.CurrentCulture, @Resources.MessageServiceError, @DateTime.Now, @Resources.MessageTypeError, @serviceErrorEventArgs.DaemonName, @serviceErrorEventArgs.Id, @serviceErrorEventArgs.Exception.Message)); }
/// <summary> /// Handles service error event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">Event data.</param> protected virtual void OnServiceError(object sender, ServiceErrorEventArgs e) { _logger.Log(_formatter.Format(e)); }
/// <summary> /// Formats message. /// </summary> /// <param name="serviceErrorEventArgs">Message.</param> /// <returns>Formatted message.</returns> public string Format(ServiceErrorEventArgs serviceErrorEventArgs) { return(String.Empty); }
private void HandleServiceErrorEvent(ServiceErrorEventArgs obj) { _sessionLogger.Write(obj.Exception, $"Service exception for data type {obj.EnitytType} named \"{obj.EntityName}\" (ID# {obj.EntityId ?? "?"})"); }