Commit e93cab16 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Provide the exception code, handle lack of message.

parent f9a4251a
...@@ -32,6 +32,18 @@ namespace VideoLAN.LibVLC ...@@ -32,6 +32,18 @@ namespace VideoLAN.LibVLC
*/ */
public class VLCException : Exception public class VLCException : Exception
{ {
int code;
/**
* VLC exception code.
*/
public int Code
{
get
{
return code;
}
}
/** /**
* Creates a managed VLC exception. * Creates a managed VLC exception.
*/ */
...@@ -57,6 +69,25 @@ namespace VideoLAN.LibVLC ...@@ -57,6 +69,25 @@ namespace VideoLAN.LibVLC
: base (message, inner) : 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 ...@@ -92,11 +123,16 @@ namespace VideoLAN.LibVLC
*/ */
public void Raise () public void Raise ()
{ {
if (raised == 0)
return;
string msg = U8String.FromNative (message);
try try
{ {
string msg = U8String.FromNative (GetMessage (this));
if (msg != null) if (msg != null)
throw new VLCException (msg); throw new VLCException (code, msg);
else
throw new VLCException (code);
} }
finally finally
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment