From bb51ca65feeb8f579c9b630321c0d30133119162 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 19 Jun 2013 21:08:03 +0100 Subject: Raise ValueError if program is invalid --- jq.pyx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'jq.pyx') diff --git a/jq.pyx b/jq.pyx index 447eeb1..604363a 100644 --- a/jq.pyx +++ b/jq.pyx @@ -67,6 +67,9 @@ def _string_to_strings(char* program, char* input): # TODO: error if !compiled cdef int compiled = jq_compile(jq, program) + if not compiled: + raise ValueError("program was not valid") + cdef jv_parser parser jv_parser_init(&parser) # TODO: is len a suitable replacement for strlen (unicode)? -- cgit v1.2.3