From: RĂ©mi Denis-Courmont Date: Sat, 21 Feb 2009 18:28:55 +0000 (+0200) Subject: Provide the exception code, handle lack of message. X-Git-Tag: 1.0.0-pre1~507 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e93cab16aa6670811ef563463575e9d4b1b04a03;p=vlc Provide the exception code, handle lack of message. --- diff --git a/bindings/cil/src/exception.cs b/bindings/cil/src/exception.cs index 9a9ce5a2ba..2b3118fa43 100644 --- a/bindings/cil/src/exception.cs +++ b/bindings/cil/src/exception.cs @@ -32,6 +32,18 @@ namespace VideoLAN.LibVLC */ public class VLCException : Exception { + int code; + /** + * VLC exception code. + */ + public int Code + { + get + { + return code; + } + } + /** * Creates a managed VLC exception. */ @@ -57,6 +69,25 @@ namespace VideoLAN.LibVLC : base (message, inner) { } + + /** + * Creates a VLC exception + * @param code VLC exception code + * @param message VLC exception message + */ + public VLCException (int code, string message) : base (message) + { + this.code = code; + } + + /** + * Creates a VLC exception + * @param code VLC exception code + */ + public VLCException (int code) : base () + { + this.code = code; + } }; /** @@ -92,11 +123,16 @@ namespace VideoLAN.LibVLC */ public void Raise () { + if (raised == 0) + return; + + string msg = U8String.FromNative (message); try { - string msg = U8String.FromNative (GetMessage (this)); if (msg != null) - throw new VLCException (msg); + throw new VLCException (code, msg); + else + throw new VLCException (code); } finally {