示例#1
0
        public static AmqpException GetAmqpException(Exception ex)
        {
            // If this exception is an AmqpException with LinkRedirect or NotAllowed errors, return it.
            if (ex is AmqpException amqpException)
            {
                if (amqpException.Error.Condition.Equals(AmqpErrorCode.LinkRedirect) || amqpException.Error.Condition.Equals(AmqpErrorCode.NotAllowed))
                {
                    return(amqpException);
                }
            }

            // Convert exception to EdgeAmqpException
            // TODO: Make sure EdgeAmqpException is thrown from the right places.
            EdgeAmqpException edgeHubAmqpException = GetEdgeHubAmqpException(ex);
            Error             amqpError            = GenerateAmqpError(edgeHubAmqpException);

            return(new AmqpException(amqpError));
        }
示例#2
0
 static Error GenerateAmqpError(EdgeAmqpException exception) => new Error
 {
     Description = JsonConvert.SerializeObject(exception.Message),
     Condition   = AmqpErrorMapper.GetErrorCondition(exception.ErrorCode),
     Info        = new Fields()
 };