Skip to content

Commit

Permalink
Shorten error message returned for user.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Oct 4, 2022
1 parent a0f9970 commit de104bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/user/admin/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ SQL query::
{
"error": {
"reason": "Invalid SQL query",
"details": "Failed to parse query due to offending symbol [DELETE] at: 'DELETE' <--- HERE... More details: Expecting tokens in {<EOF>, 'DESCRIBE', 'SELECT', 'SHOW', ';'}\nQuery failed on both V1 and V2 SQL engines. V1 SQL engine error following: \nDELETE clause is disabled by default and will be deprecated. Using the plugins.sql.delete.enabled setting to enable it",
"details": "Failed to parse query due to offending symbol [DELETE] at: 'DELETE' <--- HERE... More details: Expecting tokens in {<EOF>, 'DESCRIBE', 'SELECT', 'SHOW', ';'}",
"type": "SQLFeatureDisabledException"
},
"status": 400
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ public void sqlDeleteSettingsTest() throws IOException {
+ " \"reason\": \"Invalid SQL query\",\n"
+ " \"details\": \""
+ "Query request is not supported. Either unsupported fields are present, the "
+ "request is not a cursor request, or the response format is not supported.\\n"
+ "Query failed on both V1 and V2 SQL engines. V1 SQL engine error following: \\n"
+ "DELETE clause is disabled by default and will be deprecated."
+ " Using the plugins.sql.delete.enabled setting to enable it\",\n"
+ "request is not a cursor request, or the response format is not supported.\",\n"
+ " \"type\": \"SQLFeatureDisabledException\"\n"
+ " },\n"
+ " \"status\": 400\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ private void sendResponse(final RestChannel channel, final String message, final
private void reportError(final RestChannel channel, final Exception e, final RestStatus status) {
var message = ErrorMessageFactory.createErrorMessage(e, status.getStatus());
if (null != QueryContext.getError()) {
message.setDetails(QueryContext.getError() +
message.setDetails(QueryContext.getError());
LOG.error(QueryContext.getError() +
"\nQuery failed on both V1 and V2 SQL engines. V1 SQL engine error following: \n"
+ message.getDetails());
}
Expand Down

0 comments on commit de104bf

Please sign in to comment.