/// <summary> /// map MessageQueueErrorCode to BrokerQueueErrorCode. /// </summary> /// <param name="e">the MessageQueueErrorCode.</param> /// <returns>the BrokerQueueErrorCode.</returns> public static BrokerQueueErrorCode MapToBrokerQueueErrorCode(MessageQueueErrorCode mqError) { BrokerQueueErrorCode errorCode = BrokerQueueErrorCode.E_BQ_UNKOWN_ERROR; switch (mqError) { case MessageQueueErrorCode.InsufficientResources: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_STORAGE_INSUFFICIENT; break; case MessageQueueErrorCode.MessageStorageFailed: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_STORAGE_FAIL; break; case MessageQueueErrorCode.IOTimeout: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_OPERATION_TIMEOUT; break; case MessageQueueErrorCode.ServiceNotAvailable: errorCode = BrokerQueueErrorCode.E_BQ_PERSIST_STORAGE_NOTAVAILABLE; break; } return(errorCode); }
/// <summary> /// convert the message queue native exception to the broker queue exception. /// </summary> /// <param name="e">the message queue native exception.</param> /// <returns>the broker queue exception.</returns> public static BrokerQueueException ConvertMessageQueueException(MessageQueueNativeException e) { BrokerQueueException exception = null; if (e != null) { BrokerQueueErrorCode errorCode = MapToBrokerQueueErrorCode((MessageQueueErrorCode)e.ErrorCode); exception = new BrokerQueueException((int)errorCode, e.ErrorMessage); } return(exception); }
/// <summary> /// convert the message queue exception to the broker queue exception. /// </summary> /// <param name="e">the message queue exception.</param> /// <returns>the broker queue exception.</returns> public static BrokerQueueException ConvertMessageQueueException(MessageQueueException e) { BrokerQueueException exception = null; if (e != null) { BrokerQueueErrorCode errorCode = MapToBrokerQueueErrorCode(e.MessageQueueErrorCode); exception = new BrokerQueueException((int)errorCode, e.ToString()); } return(exception); }