From f2ced368e1003e859f887432108c634668fe905a Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Fri, 17 Sep 2004 23:33:57 +0000 Subject: [PATCH] add SigarException class --- bindings/dotnet/src/Sigar.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bindings/dotnet/src/Sigar.cs b/bindings/dotnet/src/Sigar.cs index 393ce025..25e7f927 100644 --- a/bindings/dotnet/src/Sigar.cs +++ b/bindings/dotnet/src/Sigar.cs @@ -96,6 +96,26 @@ namespace Hyperic.Sigar { } } + public class SigarException : Exception { + Sigar sigar; + int errno; + + public SigarException(Sigar sigar, int errno) : base () { + this.sigar = sigar; + this.errno = errno; + } + + [DllImport(Sigar.LIBSIGAR)] + private static extern string + sigar_strerror(IntPtr sigar, int errno); + + public override string Message { + get { + return sigar_strerror(this.sigar.sigar.Handle, this.errno); + } + } + } + [StructLayout(LayoutKind.Sequential)] public struct Mem { public readonly ulong Ram;