aboutsummaryrefslogtreecommitdiffstats
path: root/src/bindings/eina_js/eina_js_error.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/eina_js/eina_js_error.hh')
-rw-r--r--src/bindings/eina_js/eina_js_error.hh25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/bindings/eina_js/eina_js_error.hh b/src/bindings/eina_js/eina_js_error.hh
new file mode 100644
index 0000000000..49cef35161
--- /dev/null
+++ b/src/bindings/eina_js/eina_js_error.hh
@@ -0,0 +1,25 @@
+#ifndef EINA_JS_ERROR_HH
+#define EINA_JS_ERROR_HH
+
+#include <eina_js_compatibility.hh>
+
+namespace efl { namespace eina { namespace js {
+
+/**
+ * Converts the error value set through Eina's error tool to a JavaScript
+ * exception.
+ *
+ * The exception object will have a `code` string field with the `"Eina_Error"`
+ * string value and a `value` string field with the value extracted from
+ * `eina_error_msg_get`.
+ *
+ * It won't reset the error to NULL, so you can still access the error object,
+ * but if you keep calling this function without clearing the error, a new
+ * exception will be generated for each call after some error is reached. We,
+ * therefore, suggest you to call `eina_error_set(0)` afterwards.
+ */
+js::compatibility_return_type convert_error_to_javascript_exception(v8::Isolate *isolate);
+
+} } } // namespace efl::eina::js
+
+#endif /* EINA_JS_ERROR_HH */