summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2025-03-02 10:58:39 +0000
committerMichael Williamson <mike@zwobble.org>2025-03-02 10:58:39 +0000
commitd671908e7f36fea2d128fc32779ff2d77cdb890b (patch)
treee9d93dc61d9cffff3903733982119a490c2b02ab /jq.pyx
parent37c6f8a5cbb2cfc4cd9726ebc82c1ced7c7b2604 (diff)
Convert non-string errors into JSON text
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx4
1 files changed, 3 insertions, 1 deletions
diff --git a/jq.pyx b/jq.pyx
index c0a9c09..1b2056c 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -183,13 +183,15 @@ cdef void _store_error(void* store_ptr, jv error) noexcept:
cdef unicode _jq_error_to_py_string(jv error) noexcept:
+ error = jv_copy(error)
+
if jv_get_kind(error) == JV_KIND_STRING:
try:
return jv_string_to_py_string(error)
except:
return u"Internal error"
else:
- return u"(not a string)"
+ return json.dumps(_jv_to_python(error))
cdef class _ErrorStore(object):