summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib.c b/lib.c
index 9df8a62..bc7080b 100644
--- a/lib.c
+++ b/lib.c
@@ -1519,14 +1519,21 @@ ut_require_utpl(struct ut_state *s, uint32_t off, const char *path, struct json_
return ex;
}
- free(source);
-
sc = scope ? scope : xjs_new_object();
entry = ut_new_func(ut_get_op(s, s->main));
rv = ut_invoke(s, off, sc, entry, NULL);
+ if (ut_is_type(rv, T_EXCEPTION)) {
+ msg = ut_format_error(s, source);
+ ut_putval(rv);
+ rv = ut_exception(s, off, "%s", msg);
+ free(msg);
+ }
+
+ free(source);
+
json_object_put(entry);
if (sc != scope)