summaryrefslogtreecommitdiffstats
path: root/avahi-sharp/ClientException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'avahi-sharp/ClientException.cs')
-rw-r--r--avahi-sharp/ClientException.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/avahi-sharp/ClientException.cs b/avahi-sharp/ClientException.cs
new file mode 100644
index 0000000..f38f438
--- /dev/null
+++ b/avahi-sharp/ClientException.cs
@@ -0,0 +1,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);
+ }
+ }
+}