Add jq_report_error() function; use it

Put a stop to fprintf(stderr, ...) where we shouldn't.
This commit is contained in:
Nicolas Williams committed 2014-08-14 03:21:35 -05:00
1 parent 908c10928b
commit 9f13afa20f
7 files changed
+85 -73

No files matched your search

+2 -2
View File
@@ -46,7 +46,7 @@ jv build_lib_search_chain(jq_state *jq, jv lib_path) {
out_paths = jv_array_append(out_paths, path);
} else {
jv emsg = jv_invalid_get_msg(path);
fprintf(stderr, "jq: warning: skipping search path: %s\n", jv_string_value(emsg));
jq_report_error(jq, jv_string_fmt("jq: warning: skipping search path: %s\n",jv_string_value(emsg)));
jv_free(emsg);
}
}
@@ -108,7 +108,7 @@ static int process_dependencies(jq_state *jq, jv lib_origin, block *src_block, s
jv lib_path = find_lib(jq, name, search);
if (!jv_is_valid(lib_path)) {
jv emsg = jv_invalid_get_msg(lib_path);
fprintf(stderr, "jq: error: %s\n",jv_string_value(emsg));
jq_report_error(jq, jv_string_fmt("jq: error: %s\n",jv_string_value(emsg)));
jv_free(emsg);
jv_free(lib_origin);
jv_free(as);