From d671908e7f36fea2d128fc32779ff2d77cdb890b Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 2 Mar 2025 10:58:39 +0000 Subject: Convert non-string errors into JSON text --- jq.pyx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'jq.pyx') 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): -- cgit v1.2.3