Skip to content

Commit

Permalink
wrap error resoponse into exception
Browse files Browse the repository at this point in the history
Signed-off-by: Zhongnan Su <szhongna@amazon.com>
  • Loading branch information
zhongnansu committed Nov 30, 2021
1 parent 7f5ed9b commit e61b69f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sql-cli/src/opensearch_sql_cli/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ def format_output(self, data):
formatter = TabularOutputFormatter(format_name=self.table_format)

# parse response data
datarows = data["datarows"]
schema = data["schema"]
total_hits = data["total"]
cur_size = data["size"]
try:
datarows = data["datarows"]
schema = data["schema"]
total_hits = data["total"]
cur_size = data["size"]
except KeyError as e:
# in case some errors in query engine don't throw exception, leading to a KeyError
raise Exception(data)

# unused data for now,
fields = []
types = []
Expand Down

0 comments on commit e61b69f

Please sign in to comment.