Tue Nov 28 10:56:01 CET 2006 Paolo Molaro <lupus@ximian.com>
[mono.git] / mono / metadata / exception.c
index fa1d6126ac8e18c85ccf058dbd1a12cc05a50b28..b3bc6652efb4f917e1a88941fd5c4b38bbb6177f 100644 (file)
@@ -204,6 +204,18 @@ mono_get_exception_thread_abort ()
                                         "ThreadAbortException");
 }
 
+/**
+ * mono_get_exception_thread_interrupted:
+ *
+ * Returns: a new instance of the System.Threading.ThreadInterruptedException.
+ */
+MonoException *
+mono_get_exception_thread_interrupted ()
+{
+       return mono_exception_from_name (mono_get_corlib (), "System.Threading",
+                                        "ThreadInterruptedException");
+}
+
 /**
  * mono_get_exception_arithmetic:
  *
@@ -501,7 +513,7 @@ mono_get_exception_file_not_found (MonoString *fname)
 MonoException *
 mono_get_exception_file_not_found2 (const char *msg, MonoString *fname)
 {
-       MonoString *s = mono_string_new (mono_domain_get (), msg);
+       MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
 
        return mono_exception_from_name_two_strings (
                mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname);
@@ -594,6 +606,22 @@ mono_get_exception_bad_image_format (const char *msg)
        return mono_exception_from_name_msg (mono_get_corlib (), "System", "BadImageFormatException", msg);
 }      
 
+/**
+ * mono_get_exception_bad_image_format2:
+ * @msg: an informative message for the user.
+ * @fname: The full name of the file with the invalid image.
+ *
+ * Returns: a new instance of the System.BadImageFormatException
+ */
+MonoException *
+mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname)
+{
+       MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
+
+       return mono_exception_from_name_two_strings (
+               mono_get_corlib (), "System", "BadImageFormatException", s, fname);
+}
+
 /**
  * mono_get_exception_stack_overflow:
  *