Add API: set-wrappid-path.
[wrappi.git] / APIs / error.api
index e315338..2dd8652 100644 (file)
 entry_point local
 bool error ()
 <<
-  return w->error_flag;
+  return w->internal.error != NULL;
 >>
 
 entry_point local
 void clear_error ()
 <<
-  w->error_flag = 0;
+  free (w->internal.error);
+  w->internal.error = NULL;
+  w->internal.errnum = 0;
+  w->internal.error_func = NULL;
+>>
+
+entry_point local
+static_string get_error ()
+<<
+  if (!w->internal.error) {
+    set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
+    return NULL;
+  }
+  return w->internal.error;
+>>
+
+entry_point local
+int get_errno ()
+<<
+  if (!w->internal.error) {
+    set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
+    return -1;
+  }
+  return w->internal.errnum;
+>>
+
+entry_point local
+static_string get_error_func ()
+<<
+  if (!w->internal.error) {
+    set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
+    return NULL;
+  }
+  return w->internal.error_func;
 >>
 
 (*