From 0ce4b21aab50c1d173f2f41797dbfdeabba71a3d Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 14 Aug 2024 18:40:39 +0100 Subject: Handle exception in _store_error() --- jq.pyx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jq.pyx b/jq.pyx index 5ee38f4..d8ebffa 100644 --- a/jq.pyx +++ b/jq.pyx @@ -177,7 +177,12 @@ cdef void _store_error(void* store_ptr, jv error) noexcept: # TODO: handle errors not of JV_KIND_STRING cdef _ErrorStore store = <_ErrorStore>store_ptr if jv_get_kind(error) == JV_KIND_STRING: - store.store_error(jv_string_to_py_string(error)) + try: + error_string = jv_string_to_py_string(error) + except: + error_string = "Internal error" + + store.store_error(error_string) jv_free(error) -- cgit v1.2.3