aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Transport/ResponseErrorException.cs
blob: 747a07b4f7bb84a4682f5f7b2beb817819a8387d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
{
    /// <summary>
    /// Represents a tango message response exception which indicates a response container with <see cref="ErrorCode"/> different from <see cref="ErrorCode.None"/>.
    /// </summary>
    /// <seealso cref="System.Exception" />
    public class ResponseErrorException : Exception
    {
        /// <summary>
        /// Gets or sets the error.
        /// </summary>
        public ErrorCode Error { get; set; }

        public MessageType MessageType { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ResponseErrorException{T}"/> class.
        /// </summary>
        /// <param name="error">The error.</param>
        public ResponseErrorException(ErrorCode error, MessageType messageType) : base("Response " + messageType.ToString() + " returned with error " + error.ToString())
        {
            Error = error;
        }
    }
}