Merge pull request #205 from m3rlinez/master
[mono.git] / mono / metadata / exception.c
index 64965ba6efde350426f000efbebf79cfe73abd41..ee10668e20d247ff82d058cafc5dc8690204c455 100644 (file)
@@ -693,8 +693,6 @@ mono_get_exception_field_access (void)
 MonoException *
 mono_get_exception_field_access_msg (const char *msg)
 {
-       MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
-
        return mono_exception_from_name_msg (mono_get_corlib (), "System", "FieldAccessException", msg);
 }
 
@@ -718,8 +716,6 @@ mono_get_exception_method_access (void)
 MonoException *
 mono_get_exception_method_access_msg (const char *msg)
 {
-       MonoString *s = msg ? mono_string_new (mono_domain_get (), msg) : NULL;
-
        return mono_exception_from_name_msg (mono_get_corlib (), "System", "MethodAccessException", msg);
 }
 
@@ -753,3 +749,14 @@ mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions
 
        return (MonoException *) exc;
 }
+
+MonoException *
+mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception)
+{
+       MonoRuntimeWrappedException *ex = (MonoRuntimeWrappedException*)
+               mono_exception_from_name (mono_get_corlib (), "System.Runtime.CompilerServices",
+                                                                 "RuntimeWrappedException");
+
+   MONO_OBJECT_SETREF (ex, wrapped_exception, wrapped_exception);
+   return (MonoException*)ex;
+}