summaryrefslogtreecommitdiff
path: root/jq.pyx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-06-19 21:08:03 +0100
committerMichael Williamson <mike@zwobble.org>2013-06-19 21:08:03 +0100
commitbb51ca65feeb8f579c9b630321c0d30133119162 (patch)
treea473d4d21da82f9249df3729e78362287b5ac5ae /jq.pyx
parentf75fba3e2f8f6fdb4905636b92338ddb8365c381 (diff)
Raise ValueError if program is invalid
Diffstat (limited to 'jq.pyx')
-rw-r--r--jq.pyx3
1 files changed, 3 insertions, 0 deletions
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)?