/// <summary> /// Reports a job error /// </summary> /// <param name="e">The exception to report</param> /// <param name="step">The step the exception accrued</param> /// <param name="workflowMessage">The original message pulled from the queue</param> public static void ReportJobError(Exception e, ProcessorStep workflowStep, IWorkflowMessage workflowMessage, ProcessorJob currentJob) { // Push an error message to the error Queue WorkflowErrorMessage errorMessage = new WorkflowErrorMessage() { ExceptionMessage = e.Message, JobName = currentJob.JobName, StepName = workflowStep.StepName }; //if e contains inner exceptions, add those messages while (e.InnerException != null) { //assign e to the inner exception - recursive e = e.InnerException; errorMessage.ExceptionMessage += '|' + e.Message; } FrameworkManager.AddFrameworkError(currentJob, workflowMessage, errorMessage); }
/// <summary> /// Add a message containing the error to the error queue and the original message to the poison queue /// </summary> /// <param name="jobName"></param> /// <param name="message"></param> internal static void AddFrameworkError(ProcessorJob processorJob, IWorkflowMessage message, WorkflowErrorMessage errorMessage) { try { WorkflowConfiguration.LoadFrameworkConfig(processorJob); ProcessorQueue processorQueue = GetActiveQueue(processorJob, QueueOperationType.Delivery); MsmqPoisonMessageException error = new MsmqPoisonMessageException() { Source = processorJob.JobName }; error.Data["processorQueue"] = processorQueue; error.Data["message"] = message; error.Data["errorMessage"] = errorMessage; QueueOperationsHandler.HandleError(error); } catch (Exception) { } }