summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.c b/main.c
index 468f12ae..80497e77 100644
--- a/main.c
+++ b/main.c
@@ -124,6 +124,12 @@ static int process(jq_state *jq, jv value, int flags) {
if (options & UNBUFFERED_OUTPUT)
fflush(stdout);
}
+ if (jv_invalid_has_msg(jv_copy(result))) {
+ // Uncaught jq exception
+ jv msg = jv_invalid_get_msg(jv_copy(result));
+ fprintf(stderr, "jq: error: %s\n", jv_string_value(msg));
+ jv_free(msg);
+ }
jv_free(result);
return ret;
}