const char *name, MonoString *a1, MonoString *a2,
MonoError *error);
+MonoException *
+mono_exception_from_token_two_strings_checked (MonoImage *image, uint32_t token,
+ MonoString *a1, MonoString *a2,
+ MonoError *error);
+
#endif
MonoString *a1, MonoString *a2)
{
MonoError error;
- MonoClass *klass;
MonoException *ret;
+ ret = mono_exception_from_token_two_strings_checked (image, token, a1, a2, &error);
+ mono_error_cleanup (&error);
+ return ret;
+}
- klass = mono_class_get_checked (image, token, &error);
- mono_error_assert_ok (&error); /* FIXME handle the error. */
+/**
+ * mono_exception_from_token_two_strings_checked:
+ *
+ * Same as mono_exception_from_name_two_strings, but lookup the exception class using
+ * IMAGE and TOKEN.
+ */
+MonoException *
+mono_exception_from_token_two_strings_checked (MonoImage *image, guint32 token,
+ MonoString *a1, MonoString *a2,
+ MonoError *error)
+{
+ MonoClass *klass;
- ret = create_exception_two_strings (klass, a1, a2, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ mono_error_init (error);
- return ret;
+ klass = mono_class_get_checked (image, token, error);
+ mono_error_assert_ok (error); /* FIXME handle the error. */
+
+ return create_exception_two_strings (klass, a1, a2, error);
}
/**
mono_exception_from_name_msg (MonoImage *image, const char *name_space,
const char *name, const char *msg);
+MONO_RT_EXTERNAL_ONLY
MONO_API MonoException *
mono_exception_from_token_two_strings (MonoImage *image, uint32_t token,
MonoString *a1, MonoString *a2);
#include "jit-icalls.h"
#include <mono/utils/mono-error-internals.h>
+#include <mono/metadata/exception-internals.h>
#include <mono/metadata/threads-types.h>
#include <mono/metadata/reflection-internals.h>
MonoException *
mono_create_corlib_exception_1 (guint32 token, MonoString *arg)
{
- return mono_exception_from_token_two_strings (mono_defaults.corlib, token, arg, NULL);
+ MonoError error;
+ MonoException *ret = mono_exception_from_token_two_strings_checked (
+ mono_defaults.corlib, token, arg, NULL, &error);
+ mono_error_set_pending_exception (&error);
+ return ret;
}
MonoException *
mono_create_corlib_exception_2 (guint32 token, MonoString *arg1, MonoString *arg2)
{
- return mono_exception_from_token_two_strings (mono_defaults.corlib, token, arg1, arg2);
+ MonoError error;
+ MonoException *ret = mono_exception_from_token_two_strings_checked (
+ mono_defaults.corlib, token, arg1, arg2, &error);
+ mono_error_set_pending_exception (&error);
+ return ret;
}
MonoObject*