From c6109553a38e73b9dfd0b5d64efad7d65eacf497 Mon Sep 17 00:00:00 2001 From: Romain Date: Thu, 22 Oct 2020 08:34:52 +0200 Subject: [PATCH] Avoid IndexError after INSERT query (#80) --- ksql/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ksql/api.py b/ksql/api.py index 4d94211..81a16e3 100644 --- a/ksql/api.py +++ b/ksql/api.py @@ -54,7 +54,7 @@ def _raise_for_status(r, response): raise KSQLError("Unknown Error: {}".format(r.content)) else: # seems to be the old API behavior, so some errors have status 200, bug?? - if r_json[0]["@type"] == "currentStatus" and r_json[0]["commandStatus"]["status"] == "ERROR": + if r_json and r_json[0]["@type"] == "currentStatus" and r_json[0]["commandStatus"]["status"] == "ERROR": error_message = r_json[0]["commandStatus"]["message"] error_code = None stackTrace = None