/// <summary> /// 发送错误 /// </summary> /// <param name="errors"></param> /// <returns></returns> public static ProducerResult Failed(params ProducerError[] errors) { var result = new ProducerResult { Succeeded = false }; if (errors != null) { result.Errors.AddRange(errors); } return(result); }
private ProducerResult ExceptionReturn(string bodyString, string hostAddress, Exception ex) { ProducerSentFailedException wrapperEx = new ProducerSentFailedException(ex.Message, ex); ProducerError errors = new ProducerError { Code = ex.HResult.ToString(), Description = ex.Message, HostAddress = hostAddress, Body = bodyString }; return(ProducerResult.Failed(wrapperEx, errors)); }