Added friendlier dsql error message for 405 (which occurs when druid.sql.enabled=false) (#7112)

* Added friendlier error message for dsql 405

* no extra char

* Changed error message

* fixed weird spacing
This commit is contained in:
Justin Borromeo 2019-02-27 21:40:30 -07:00 committed by Gian Merlino
parent 0b4f771062
commit c7082ba36e
1 changed files with 4 additions and 0 deletions

View File

@ -136,6 +136,10 @@ def raise_friendly_error(e):
if error_obj['host']: if error_obj['host']:
error_text = error_text + ' (' + str(error_obj['host']) + ')' error_text = error_text + ' (' + str(error_obj['host']) + ')'
raise DruidSqlException(error_text) raise DruidSqlException(error_text)
elif e.code == 405:
error_text = 'HTTP Error {0}: {1}\n{2}'.format(e.code, e.reason + " - Are you using the correct broker URL and " +\
"is druid.sql.enabled set to true on your broker?", text)
raise DruidSqlException(error_text)
else: else:
raise DruidSqlException("HTTP Error {0}: {1}\n{2}".format(e.code, e.reason, text)) raise DruidSqlException("HTTP Error {0}: {1}\n{2}".format(e.code, e.reason, text))
else: else: