using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.PMR;
using Tango.PMR.Common;
namespace Tango.Transport
{
///
/// Represents a tango message response exception which indicates a response container with different from .
///
///
public class ResponseErrorException : Exception
{
///
/// Gets or sets the container.
///
public MessageContainer Container { get; set; }
///
/// Initializes a new instance of the class.
///
/// The error.
public ResponseErrorException(MessageContainer container, String requestName) : base(
container.Error != ErrorCode.GeneralError || String.IsNullOrEmpty(container.ErrorMessage) ?
$"{requestName} has returned with an error ({container.Error})\n{container.ErrorMessage}"
:
$"{requestName} failed.\n{container.ErrorMessage}")
{
Container = container;
}
}
}