@onivoro/server-aws-redshift 22.0.8 → 22.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -172,21 +172,26 @@ let RedshiftDataService = class RedshiftDataService {
172
172
  let status = "";
173
173
  do {
174
174
  const describeCommand = new client_redshift_data_1.DescribeStatementCommand({ Id });
175
- const { Status } = await this.redshiftDataClient.send(describeCommand);
175
+ const { Status, Error: err } = await this.redshiftDataClient.send(describeCommand);
176
176
  status = Status || "";
177
177
  if (status === "FAILED") {
178
- throw new Error("Query execution failed");
178
+ throw new Error(err);
179
179
  }
180
180
  if (status !== "FINISHED") {
181
181
  await new Promise(resolve => setTimeout(resolve, 1000));
182
182
  }
183
183
  } while (status !== "FINISHED");
184
- const getResultsCommand = new client_redshift_data_1.GetStatementResultCommand({ Id });
185
- const results = await this.redshiftDataClient.send(getResultsCommand);
186
- const records = results.Records || [];
187
- return records.map(record => {
188
- return record.map(field => field.stringValue || field.longValue || field.doubleValue);
189
- });
184
+ try {
185
+ const getResultsCommand = new client_redshift_data_1.GetStatementResultCommand({ Id });
186
+ const results = await this.redshiftDataClient.send(getResultsCommand);
187
+ const records = results.Records || [];
188
+ return records.map(record => {
189
+ return record.map(field => field.stringValue || field.longValue || field.doubleValue);
190
+ });
191
+ }
192
+ catch (error) {
193
+ return [];
194
+ }
190
195
  }
191
196
  catch (error) {
192
197
  console.error({ detail: "Error executing query:", error });
@@ -172,21 +172,26 @@ let RedshiftDataService = class RedshiftDataService {
172
172
  let status = "";
173
173
  do {
174
174
  const describeCommand = new client_redshift_data_1.DescribeStatementCommand({ Id });
175
- const { Status } = await this.redshiftDataClient.send(describeCommand);
175
+ const { Status, Error: err } = await this.redshiftDataClient.send(describeCommand);
176
176
  status = Status || "";
177
177
  if (status === "FAILED") {
178
- throw new Error("Query execution failed");
178
+ throw new Error(err);
179
179
  }
180
180
  if (status !== "FINISHED") {
181
181
  await new Promise(resolve => setTimeout(resolve, 1000));
182
182
  }
183
183
  } while (status !== "FINISHED");
184
- const getResultsCommand = new client_redshift_data_1.GetStatementResultCommand({ Id });
185
- const results = await this.redshiftDataClient.send(getResultsCommand);
186
- const records = results.Records || [];
187
- return records.map(record => {
188
- return record.map(field => field.stringValue || field.longValue || field.doubleValue);
189
- });
184
+ try {
185
+ const getResultsCommand = new client_redshift_data_1.GetStatementResultCommand({ Id });
186
+ const results = await this.redshiftDataClient.send(getResultsCommand);
187
+ const records = results.Records || [];
188
+ return records.map(record => {
189
+ return record.map(field => field.stringValue || field.longValue || field.doubleValue);
190
+ });
191
+ }
192
+ catch (error) {
193
+ return [];
194
+ }
190
195
  }
191
196
  catch (error) {
192
197
  console.error({ detail: "Error executing query:", error });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onivoro/server-aws-redshift",
3
- "version": "22.0.8",
3
+ "version": "22.0.10",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/onivoro/server-aws-redshift.git"
6
6
  },