summaryrefslogtreecommitdiffstats
path: root/avahi-sharp/ClientException.cs
blob: f38f43803b6a4af1521f1eefef3c4312ff4500d3 (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

using System;
using System.Runtime.InteropServices;

namespace Avahi
{
    public class ClientException : ApplicationException
    {
        private int code;

        [DllImport ("avahi-common")]
        private static extern IntPtr avahi_strerror (int code);
        
        public int ErrorCode
        {
            get { return code; }
        }
        
        internal ClientException (int code) : base (GetErrorString (code))
        {
            this.code = code;
        }

        private static string GetErrorString (int code)
        {
            IntPtr str = avahi_strerror (code);
            return Utility.PtrToString (str);
        }
    }
}