[vlc-devel] commit: Provide the exception code, handle lack of message. ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 21 19:29:47 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Feb 21 20:28:55 2009 +0200| [e93cab16aa6670811ef563463575e9d4b1b04a03] | committer: Rémi Denis-Courmont 

Provide the exception code, handle lack of message.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e93cab16aa6670811ef563463575e9d4b1b04a03
---

 bindings/cil/src/exception.cs |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/bindings/cil/src/exception.cs b/bindings/cil/src/exception.cs
index 9a9ce5a..2b3118f 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
             {




More information about the vlc-devel mailing list