Merge pull request #2698 from esdrubal/iosxmlarray
[mono.git] / mono / metadata / exception.c
index cdf5ea0965e97c2a795733944fb8f81d9f73ad75..e2c45aca38bbc615c7547112df6253a7475560bb 100644 (file)
@@ -966,11 +966,27 @@ mono_error_raise_exception (MonoError *target_error)
                mono_raise_exception (ex);
 }
 
-void
+/**
+ * mono_error_set_pending_exception:
+ * @error: The error
+ *
+ *
+ * If @error is set, convert it to an exception and set the pending exception for the current icall.
+ * Returns TRUE if @error was set, or FALSE otherwise, so that you can write:
+ *    if (mono_error_set_pending_exception (error)) {
+ *      { ... cleanup code ... }
+ *      return;
+ *    }
+ */
+gboolean
 mono_error_set_pending_exception (MonoError *error)
 {
        MonoException *ex = mono_error_convert_to_exception (error);
-       if (ex)
+       if (ex) {
                mono_set_pending_exception (ex);
+               return TRUE;
+       } else {
+               return FALSE;
+       }
 }