error(x) should not tostring its arg; fix #466
This commit is contained in:
1 parent
824f7df404
commit
a68958e5dc
2 files changed
+6
-2
No files matched your search
@@ -781,7 +781,6 @@ static jv f_type(jv input) {
|
|||||||
|
|
||||||
static jv f_error(jv input, jv msg) {
|
static jv f_error(jv input, jv msg) {
|
||||||
jv_free(input);
|
jv_free(input);
|
||||||
msg = f_tostring(msg);
|
|
||||||
return jv_invalid_with_msg(msg);
|
return jv_invalid_with_msg(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,12 @@ static int process(jq_state *jq, jv value, int flags) {
|
|||||||
if (jv_invalid_has_msg(jv_copy(result))) {
|
if (jv_invalid_has_msg(jv_copy(result))) {
|
||||||
// Uncaught jq exception
|
// Uncaught jq exception
|
||||||
jv msg = jv_invalid_get_msg(jv_copy(result));
|
jv msg = jv_invalid_get_msg(jv_copy(result));
|
||||||
fprintf(stderr, "jq: error: %s\n", jv_string_value(msg));
|
if (jv_get_kind(msg) == JV_KIND_STRING) {
|
||||||
|
fprintf(stderr, "jq: error: %s\n", jv_string_value(msg));
|
||||||
|
} else {
|
||||||
|
msg = jv_dump_string(msg, 0);
|
||||||
|
fprintf(stderr, "jq: error (not a string): %s\n", jv_string_value(msg));
|
||||||
|
}
|
||||||
jv_free(msg);
|
jv_free(msg);
|
||||||
}
|
}
|
||||||
jv_free(result);
|
jv_free(result);
|
||||||
|
|||||||
Reference in new issue
Block a user