From 6d8474a16a9e0d1d543a7b0dbe916b6675d41cfe Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 19 Jan 2021 12:16:22 -0500 Subject: [PATCH] Fix node errors being swalled by print_error Node specific errors were not processed, correct that oversight. --- confluent_client/confluent/client.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/confluent_client/confluent/client.py b/confluent_client/confluent/client.py index 11ba16ac..5a29ea60 100644 --- a/confluent_client/confluent/client.py +++ b/confluent_client/confluent/client.py @@ -111,6 +111,12 @@ def printerror(res, node=None): exitcode = 0 if 'errorcode' in res: exitcode = res['errorcode'] + for node in res.get('databynode', {}): + exitcode = res['databynode'][node].get('errorcode', exitcode) + if 'error' in res['databynode'][node]: + sys.stderr.write('{0}: {1}\n'.format(node, res['databynode'][node]['error'])) + if exitcode == 0: + exitcode = 1 if 'error' in res: if node: sys.stderr.write('{0}: {1}\n'.format(node, res['error']))