Skip to content

Commit

Permalink
SNOW-502598: Refactor getQueryStatusThrowIfError
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Oct 31, 2023
1 parent 6c00000 commit 357359a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,17 @@ function Connection(context)
* @returns {String} the query status.
*/
this.getQueryStatusThrowIfError = async function (queryId) {
const response = await getQueryResponse(queryId);
const queries = response['data']['queries'];
const status = extractQueryStatus(response);
const status = this.getQueryStatus(queryId);

let message, code, sqlState = null;

if (this.isAnError(status)) {
const response = await getQueryResponse(queryId);
message = response['message'] || '';
code = response['code'] || -1;

if (response['data']) {
message += queries.length > 0 ? queries[0]['errorMessage'] : '';
message += response['data']['queries'].length > 0 ? response['data']['queries'][0]['errorMessage'] : '';
sqlState = response['data']['sqlState'];
}

Expand Down

0 comments on commit 357359a

Please sign in to comment.