@aws-sdk/client-redshift-data 3.52.0 → 3.53.0

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.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deserializeAws_json1_1ListTablesCommand = exports.deserializeAws_json1_1ListStatementsCommand = exports.deserializeAws_json1_1ListSchemasCommand = exports.deserializeAws_json1_1ListDatabasesCommand = exports.deserializeAws_json1_1GetStatementResultCommand = exports.deserializeAws_json1_1ExecuteStatementCommand = exports.deserializeAws_json1_1DescribeTableCommand = exports.deserializeAws_json1_1DescribeStatementCommand = exports.deserializeAws_json1_1CancelStatementCommand = exports.deserializeAws_json1_1BatchExecuteStatementCommand = exports.serializeAws_json1_1ListTablesCommand = exports.serializeAws_json1_1ListStatementsCommand = exports.serializeAws_json1_1ListSchemasCommand = exports.serializeAws_json1_1ListDatabasesCommand = exports.serializeAws_json1_1GetStatementResultCommand = exports.serializeAws_json1_1ExecuteStatementCommand = exports.serializeAws_json1_1DescribeTableCommand = exports.serializeAws_json1_1DescribeStatementCommand = exports.serializeAws_json1_1CancelStatementCommand = exports.serializeAws_json1_1BatchExecuteStatementCommand = void 0;
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const smithy_client_1 = require("@aws-sdk/smithy-client");
6
+ const models_0_1 = require("../models/models_0");
7
+ const RedshiftDataServiceException_1 = require("../models/RedshiftDataServiceException");
6
8
  const serializeAws_json1_1BatchExecuteStatementCommand = async (input, context) => {
7
9
  const headers = {
8
10
  "content-type": "application/x-amz-json-1.1",
@@ -128,43 +130,22 @@ const deserializeAws_json1_1BatchExecuteStatementCommandError = async (output, c
128
130
  switch (errorCode) {
129
131
  case "ActiveStatementsExceededException":
130
132
  case "com.amazonaws.redshiftdata#ActiveStatementsExceededException":
131
- response = {
132
- ...(await deserializeAws_json1_1ActiveStatementsExceededExceptionResponse(parsedOutput, context)),
133
- name: errorCode,
134
- $metadata: deserializeMetadata(output),
135
- };
136
- break;
133
+ throw await deserializeAws_json1_1ActiveStatementsExceededExceptionResponse(parsedOutput, context);
137
134
  case "BatchExecuteStatementException":
138
135
  case "com.amazonaws.redshiftdata#BatchExecuteStatementException":
139
- response = {
140
- ...(await deserializeAws_json1_1BatchExecuteStatementExceptionResponse(parsedOutput, context)),
141
- name: errorCode,
142
- $metadata: deserializeMetadata(output),
143
- };
144
- break;
136
+ throw await deserializeAws_json1_1BatchExecuteStatementExceptionResponse(parsedOutput, context);
145
137
  case "ValidationException":
146
138
  case "com.amazonaws.redshiftdata#ValidationException":
147
- response = {
148
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
149
- name: errorCode,
150
- $metadata: deserializeMetadata(output),
151
- };
152
- break;
139
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
153
140
  default:
154
141
  const parsedBody = parsedOutput.body;
155
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
156
- response = {
157
- ...parsedBody,
158
- name: `${errorCode}`,
159
- message: parsedBody.message || parsedBody.Message || errorCode,
142
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
143
+ name: parsedBody.code || parsedBody.Code || errorCode,
160
144
  $fault: "client",
161
145
  $metadata: deserializeMetadata(output),
162
- };
146
+ });
147
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
163
148
  }
164
- const message = response.message || response.Message || errorCode;
165
- response.message = message;
166
- delete response.Message;
167
- return Promise.reject(Object.assign(new Error(message), response));
168
149
  };
169
150
  const deserializeAws_json1_1CancelStatementCommand = async (output, context) => {
170
151
  if (output.statusCode >= 300) {
@@ -191,51 +172,25 @@ const deserializeAws_json1_1CancelStatementCommandError = async (output, context
191
172
  switch (errorCode) {
192
173
  case "DatabaseConnectionException":
193
174
  case "com.amazonaws.redshiftdata#DatabaseConnectionException":
194
- response = {
195
- ...(await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context)),
196
- name: errorCode,
197
- $metadata: deserializeMetadata(output),
198
- };
199
- break;
175
+ throw await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context);
200
176
  case "InternalServerException":
201
177
  case "com.amazonaws.redshiftdata#InternalServerException":
202
- response = {
203
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
204
- name: errorCode,
205
- $metadata: deserializeMetadata(output),
206
- };
207
- break;
178
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
208
179
  case "ResourceNotFoundException":
209
180
  case "com.amazonaws.redshiftdata#ResourceNotFoundException":
210
- response = {
211
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
212
- name: errorCode,
213
- $metadata: deserializeMetadata(output),
214
- };
215
- break;
181
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
216
182
  case "ValidationException":
217
183
  case "com.amazonaws.redshiftdata#ValidationException":
218
- response = {
219
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
220
- name: errorCode,
221
- $metadata: deserializeMetadata(output),
222
- };
223
- break;
184
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
224
185
  default:
225
186
  const parsedBody = parsedOutput.body;
226
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
227
- response = {
228
- ...parsedBody,
229
- name: `${errorCode}`,
230
- message: parsedBody.message || parsedBody.Message || errorCode,
187
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
188
+ name: parsedBody.code || parsedBody.Code || errorCode,
231
189
  $fault: "client",
232
190
  $metadata: deserializeMetadata(output),
233
- };
191
+ });
192
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
234
193
  }
235
- const message = response.message || response.Message || errorCode;
236
- response.message = message;
237
- delete response.Message;
238
- return Promise.reject(Object.assign(new Error(message), response));
239
194
  };
240
195
  const deserializeAws_json1_1DescribeStatementCommand = async (output, context) => {
241
196
  if (output.statusCode >= 300) {
@@ -262,43 +217,22 @@ const deserializeAws_json1_1DescribeStatementCommandError = async (output, conte
262
217
  switch (errorCode) {
263
218
  case "InternalServerException":
264
219
  case "com.amazonaws.redshiftdata#InternalServerException":
265
- response = {
266
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
267
- name: errorCode,
268
- $metadata: deserializeMetadata(output),
269
- };
270
- break;
220
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
271
221
  case "ResourceNotFoundException":
272
222
  case "com.amazonaws.redshiftdata#ResourceNotFoundException":
273
- response = {
274
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
275
- name: errorCode,
276
- $metadata: deserializeMetadata(output),
277
- };
278
- break;
223
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
279
224
  case "ValidationException":
280
225
  case "com.amazonaws.redshiftdata#ValidationException":
281
- response = {
282
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
283
- name: errorCode,
284
- $metadata: deserializeMetadata(output),
285
- };
286
- break;
226
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
287
227
  default:
288
228
  const parsedBody = parsedOutput.body;
289
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
290
- response = {
291
- ...parsedBody,
292
- name: `${errorCode}`,
293
- message: parsedBody.message || parsedBody.Message || errorCode,
229
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
230
+ name: parsedBody.code || parsedBody.Code || errorCode,
294
231
  $fault: "client",
295
232
  $metadata: deserializeMetadata(output),
296
- };
233
+ });
234
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
297
235
  }
298
- const message = response.message || response.Message || errorCode;
299
- response.message = message;
300
- delete response.Message;
301
- return Promise.reject(Object.assign(new Error(message), response));
302
236
  };
303
237
  const deserializeAws_json1_1DescribeTableCommand = async (output, context) => {
304
238
  if (output.statusCode >= 300) {
@@ -325,43 +259,22 @@ const deserializeAws_json1_1DescribeTableCommandError = async (output, context)
325
259
  switch (errorCode) {
326
260
  case "DatabaseConnectionException":
327
261
  case "com.amazonaws.redshiftdata#DatabaseConnectionException":
328
- response = {
329
- ...(await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context)),
330
- name: errorCode,
331
- $metadata: deserializeMetadata(output),
332
- };
333
- break;
262
+ throw await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context);
334
263
  case "InternalServerException":
335
264
  case "com.amazonaws.redshiftdata#InternalServerException":
336
- response = {
337
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
338
- name: errorCode,
339
- $metadata: deserializeMetadata(output),
340
- };
341
- break;
265
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
342
266
  case "ValidationException":
343
267
  case "com.amazonaws.redshiftdata#ValidationException":
344
- response = {
345
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
346
- name: errorCode,
347
- $metadata: deserializeMetadata(output),
348
- };
349
- break;
268
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
350
269
  default:
351
270
  const parsedBody = parsedOutput.body;
352
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
353
- response = {
354
- ...parsedBody,
355
- name: `${errorCode}`,
356
- message: parsedBody.message || parsedBody.Message || errorCode,
271
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
272
+ name: parsedBody.code || parsedBody.Code || errorCode,
357
273
  $fault: "client",
358
274
  $metadata: deserializeMetadata(output),
359
- };
275
+ });
276
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
360
277
  }
361
- const message = response.message || response.Message || errorCode;
362
- response.message = message;
363
- delete response.Message;
364
- return Promise.reject(Object.assign(new Error(message), response));
365
278
  };
366
279
  const deserializeAws_json1_1ExecuteStatementCommand = async (output, context) => {
367
280
  if (output.statusCode >= 300) {
@@ -388,43 +301,22 @@ const deserializeAws_json1_1ExecuteStatementCommandError = async (output, contex
388
301
  switch (errorCode) {
389
302
  case "ActiveStatementsExceededException":
390
303
  case "com.amazonaws.redshiftdata#ActiveStatementsExceededException":
391
- response = {
392
- ...(await deserializeAws_json1_1ActiveStatementsExceededExceptionResponse(parsedOutput, context)),
393
- name: errorCode,
394
- $metadata: deserializeMetadata(output),
395
- };
396
- break;
304
+ throw await deserializeAws_json1_1ActiveStatementsExceededExceptionResponse(parsedOutput, context);
397
305
  case "ExecuteStatementException":
398
306
  case "com.amazonaws.redshiftdata#ExecuteStatementException":
399
- response = {
400
- ...(await deserializeAws_json1_1ExecuteStatementExceptionResponse(parsedOutput, context)),
401
- name: errorCode,
402
- $metadata: deserializeMetadata(output),
403
- };
404
- break;
307
+ throw await deserializeAws_json1_1ExecuteStatementExceptionResponse(parsedOutput, context);
405
308
  case "ValidationException":
406
309
  case "com.amazonaws.redshiftdata#ValidationException":
407
- response = {
408
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
409
- name: errorCode,
410
- $metadata: deserializeMetadata(output),
411
- };
412
- break;
310
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
413
311
  default:
414
312
  const parsedBody = parsedOutput.body;
415
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
416
- response = {
417
- ...parsedBody,
418
- name: `${errorCode}`,
419
- message: parsedBody.message || parsedBody.Message || errorCode,
313
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
314
+ name: parsedBody.code || parsedBody.Code || errorCode,
420
315
  $fault: "client",
421
316
  $metadata: deserializeMetadata(output),
422
- };
317
+ });
318
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
423
319
  }
424
- const message = response.message || response.Message || errorCode;
425
- response.message = message;
426
- delete response.Message;
427
- return Promise.reject(Object.assign(new Error(message), response));
428
320
  };
429
321
  const deserializeAws_json1_1GetStatementResultCommand = async (output, context) => {
430
322
  if (output.statusCode >= 300) {
@@ -451,43 +343,22 @@ const deserializeAws_json1_1GetStatementResultCommandError = async (output, cont
451
343
  switch (errorCode) {
452
344
  case "InternalServerException":
453
345
  case "com.amazonaws.redshiftdata#InternalServerException":
454
- response = {
455
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
456
- name: errorCode,
457
- $metadata: deserializeMetadata(output),
458
- };
459
- break;
346
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
460
347
  case "ResourceNotFoundException":
461
348
  case "com.amazonaws.redshiftdata#ResourceNotFoundException":
462
- response = {
463
- ...(await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)),
464
- name: errorCode,
465
- $metadata: deserializeMetadata(output),
466
- };
467
- break;
349
+ throw await deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context);
468
350
  case "ValidationException":
469
351
  case "com.amazonaws.redshiftdata#ValidationException":
470
- response = {
471
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
472
- name: errorCode,
473
- $metadata: deserializeMetadata(output),
474
- };
475
- break;
352
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
476
353
  default:
477
354
  const parsedBody = parsedOutput.body;
478
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
479
- response = {
480
- ...parsedBody,
481
- name: `${errorCode}`,
482
- message: parsedBody.message || parsedBody.Message || errorCode,
355
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
356
+ name: parsedBody.code || parsedBody.Code || errorCode,
483
357
  $fault: "client",
484
358
  $metadata: deserializeMetadata(output),
485
- };
359
+ });
360
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
486
361
  }
487
- const message = response.message || response.Message || errorCode;
488
- response.message = message;
489
- delete response.Message;
490
- return Promise.reject(Object.assign(new Error(message), response));
491
362
  };
492
363
  const deserializeAws_json1_1ListDatabasesCommand = async (output, context) => {
493
364
  if (output.statusCode >= 300) {
@@ -514,43 +385,22 @@ const deserializeAws_json1_1ListDatabasesCommandError = async (output, context)
514
385
  switch (errorCode) {
515
386
  case "DatabaseConnectionException":
516
387
  case "com.amazonaws.redshiftdata#DatabaseConnectionException":
517
- response = {
518
- ...(await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context)),
519
- name: errorCode,
520
- $metadata: deserializeMetadata(output),
521
- };
522
- break;
388
+ throw await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context);
523
389
  case "InternalServerException":
524
390
  case "com.amazonaws.redshiftdata#InternalServerException":
525
- response = {
526
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
527
- name: errorCode,
528
- $metadata: deserializeMetadata(output),
529
- };
530
- break;
391
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
531
392
  case "ValidationException":
532
393
  case "com.amazonaws.redshiftdata#ValidationException":
533
- response = {
534
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
535
- name: errorCode,
536
- $metadata: deserializeMetadata(output),
537
- };
538
- break;
394
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
539
395
  default:
540
396
  const parsedBody = parsedOutput.body;
541
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
542
- response = {
543
- ...parsedBody,
544
- name: `${errorCode}`,
545
- message: parsedBody.message || parsedBody.Message || errorCode,
397
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
398
+ name: parsedBody.code || parsedBody.Code || errorCode,
546
399
  $fault: "client",
547
400
  $metadata: deserializeMetadata(output),
548
- };
401
+ });
402
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
549
403
  }
550
- const message = response.message || response.Message || errorCode;
551
- response.message = message;
552
- delete response.Message;
553
- return Promise.reject(Object.assign(new Error(message), response));
554
404
  };
555
405
  const deserializeAws_json1_1ListSchemasCommand = async (output, context) => {
556
406
  if (output.statusCode >= 300) {
@@ -577,43 +427,22 @@ const deserializeAws_json1_1ListSchemasCommandError = async (output, context) =>
577
427
  switch (errorCode) {
578
428
  case "DatabaseConnectionException":
579
429
  case "com.amazonaws.redshiftdata#DatabaseConnectionException":
580
- response = {
581
- ...(await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context)),
582
- name: errorCode,
583
- $metadata: deserializeMetadata(output),
584
- };
585
- break;
430
+ throw await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context);
586
431
  case "InternalServerException":
587
432
  case "com.amazonaws.redshiftdata#InternalServerException":
588
- response = {
589
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
590
- name: errorCode,
591
- $metadata: deserializeMetadata(output),
592
- };
593
- break;
433
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
594
434
  case "ValidationException":
595
435
  case "com.amazonaws.redshiftdata#ValidationException":
596
- response = {
597
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
598
- name: errorCode,
599
- $metadata: deserializeMetadata(output),
600
- };
601
- break;
436
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
602
437
  default:
603
438
  const parsedBody = parsedOutput.body;
604
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
605
- response = {
606
- ...parsedBody,
607
- name: `${errorCode}`,
608
- message: parsedBody.message || parsedBody.Message || errorCode,
439
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
440
+ name: parsedBody.code || parsedBody.Code || errorCode,
609
441
  $fault: "client",
610
442
  $metadata: deserializeMetadata(output),
611
- };
443
+ });
444
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
612
445
  }
613
- const message = response.message || response.Message || errorCode;
614
- response.message = message;
615
- delete response.Message;
616
- return Promise.reject(Object.assign(new Error(message), response));
617
446
  };
618
447
  const deserializeAws_json1_1ListStatementsCommand = async (output, context) => {
619
448
  if (output.statusCode >= 300) {
@@ -640,35 +469,19 @@ const deserializeAws_json1_1ListStatementsCommandError = async (output, context)
640
469
  switch (errorCode) {
641
470
  case "InternalServerException":
642
471
  case "com.amazonaws.redshiftdata#InternalServerException":
643
- response = {
644
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
645
- name: errorCode,
646
- $metadata: deserializeMetadata(output),
647
- };
648
- break;
472
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
649
473
  case "ValidationException":
650
474
  case "com.amazonaws.redshiftdata#ValidationException":
651
- response = {
652
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
653
- name: errorCode,
654
- $metadata: deserializeMetadata(output),
655
- };
656
- break;
475
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
657
476
  default:
658
477
  const parsedBody = parsedOutput.body;
659
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
660
- response = {
661
- ...parsedBody,
662
- name: `${errorCode}`,
663
- message: parsedBody.message || parsedBody.Message || errorCode,
478
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
479
+ name: parsedBody.code || parsedBody.Code || errorCode,
664
480
  $fault: "client",
665
481
  $metadata: deserializeMetadata(output),
666
- };
482
+ });
483
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
667
484
  }
668
- const message = response.message || response.Message || errorCode;
669
- response.message = message;
670
- delete response.Message;
671
- return Promise.reject(Object.assign(new Error(message), response));
672
485
  };
673
486
  const deserializeAws_json1_1ListTablesCommand = async (output, context) => {
674
487
  if (output.statusCode >= 300) {
@@ -695,120 +508,85 @@ const deserializeAws_json1_1ListTablesCommandError = async (output, context) =>
695
508
  switch (errorCode) {
696
509
  case "DatabaseConnectionException":
697
510
  case "com.amazonaws.redshiftdata#DatabaseConnectionException":
698
- response = {
699
- ...(await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context)),
700
- name: errorCode,
701
- $metadata: deserializeMetadata(output),
702
- };
703
- break;
511
+ throw await deserializeAws_json1_1DatabaseConnectionExceptionResponse(parsedOutput, context);
704
512
  case "InternalServerException":
705
513
  case "com.amazonaws.redshiftdata#InternalServerException":
706
- response = {
707
- ...(await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)),
708
- name: errorCode,
709
- $metadata: deserializeMetadata(output),
710
- };
711
- break;
514
+ throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context);
712
515
  case "ValidationException":
713
516
  case "com.amazonaws.redshiftdata#ValidationException":
714
- response = {
715
- ...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
716
- name: errorCode,
717
- $metadata: deserializeMetadata(output),
718
- };
719
- break;
517
+ throw await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context);
720
518
  default:
721
519
  const parsedBody = parsedOutput.body;
722
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
723
- response = {
724
- ...parsedBody,
725
- name: `${errorCode}`,
726
- message: parsedBody.message || parsedBody.Message || errorCode,
520
+ response = new RedshiftDataServiceException_1.RedshiftDataServiceException({
521
+ name: parsedBody.code || parsedBody.Code || errorCode,
727
522
  $fault: "client",
728
523
  $metadata: deserializeMetadata(output),
729
- };
524
+ });
525
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
730
526
  }
731
- const message = response.message || response.Message || errorCode;
732
- response.message = message;
733
- delete response.Message;
734
- return Promise.reject(Object.assign(new Error(message), response));
735
527
  };
736
528
  const deserializeAws_json1_1ActiveStatementsExceededExceptionResponse = async (parsedOutput, context) => {
737
529
  const body = parsedOutput.body;
738
530
  const deserialized = deserializeAws_json1_1ActiveStatementsExceededException(body, context);
739
- const contents = {
740
- name: "ActiveStatementsExceededException",
741
- $fault: "client",
531
+ const exception = new models_0_1.ActiveStatementsExceededException({
742
532
  $metadata: deserializeMetadata(parsedOutput),
743
533
  ...deserialized,
744
- };
745
- return contents;
534
+ });
535
+ return smithy_client_1.decorateServiceException(exception, body);
746
536
  };
747
537
  const deserializeAws_json1_1BatchExecuteStatementExceptionResponse = async (parsedOutput, context) => {
748
538
  const body = parsedOutput.body;
749
539
  const deserialized = deserializeAws_json1_1BatchExecuteStatementException(body, context);
750
- const contents = {
751
- name: "BatchExecuteStatementException",
752
- $fault: "server",
540
+ const exception = new models_0_1.BatchExecuteStatementException({
753
541
  $metadata: deserializeMetadata(parsedOutput),
754
542
  ...deserialized,
755
- };
756
- return contents;
543
+ });
544
+ return smithy_client_1.decorateServiceException(exception, body);
757
545
  };
758
546
  const deserializeAws_json1_1DatabaseConnectionExceptionResponse = async (parsedOutput, context) => {
759
547
  const body = parsedOutput.body;
760
548
  const deserialized = deserializeAws_json1_1DatabaseConnectionException(body, context);
761
- const contents = {
762
- name: "DatabaseConnectionException",
763
- $fault: "server",
549
+ const exception = new models_0_1.DatabaseConnectionException({
764
550
  $metadata: deserializeMetadata(parsedOutput),
765
551
  ...deserialized,
766
- };
767
- return contents;
552
+ });
553
+ return smithy_client_1.decorateServiceException(exception, body);
768
554
  };
769
555
  const deserializeAws_json1_1ExecuteStatementExceptionResponse = async (parsedOutput, context) => {
770
556
  const body = parsedOutput.body;
771
557
  const deserialized = deserializeAws_json1_1ExecuteStatementException(body, context);
772
- const contents = {
773
- name: "ExecuteStatementException",
774
- $fault: "server",
558
+ const exception = new models_0_1.ExecuteStatementException({
775
559
  $metadata: deserializeMetadata(parsedOutput),
776
560
  ...deserialized,
777
- };
778
- return contents;
561
+ });
562
+ return smithy_client_1.decorateServiceException(exception, body);
779
563
  };
780
564
  const deserializeAws_json1_1InternalServerExceptionResponse = async (parsedOutput, context) => {
781
565
  const body = parsedOutput.body;
782
566
  const deserialized = deserializeAws_json1_1InternalServerException(body, context);
783
- const contents = {
784
- name: "InternalServerException",
785
- $fault: "server",
567
+ const exception = new models_0_1.InternalServerException({
786
568
  $metadata: deserializeMetadata(parsedOutput),
787
569
  ...deserialized,
788
- };
789
- return contents;
570
+ });
571
+ return smithy_client_1.decorateServiceException(exception, body);
790
572
  };
791
573
  const deserializeAws_json1_1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
792
574
  const body = parsedOutput.body;
793
575
  const deserialized = deserializeAws_json1_1ResourceNotFoundException(body, context);
794
- const contents = {
795
- name: "ResourceNotFoundException",
796
- $fault: "client",
576
+ const exception = new models_0_1.ResourceNotFoundException({
797
577
  $metadata: deserializeMetadata(parsedOutput),
798
578
  ...deserialized,
799
- };
800
- return contents;
579
+ });
580
+ return smithy_client_1.decorateServiceException(exception, body);
801
581
  };
802
582
  const deserializeAws_json1_1ValidationExceptionResponse = async (parsedOutput, context) => {
803
583
  const body = parsedOutput.body;
804
584
  const deserialized = deserializeAws_json1_1ValidationException(body, context);
805
- const contents = {
806
- name: "ValidationException",
807
- $fault: "client",
585
+ const exception = new models_0_1.ValidationException({
808
586
  $metadata: deserializeMetadata(parsedOutput),
809
587
  ...deserialized,
810
- };
811
- return contents;
588
+ });
589
+ return smithy_client_1.decorateServiceException(exception, body);
812
590
  };
813
591
  const serializeAws_json1_1BatchExecuteStatementInput = (input, context) => {
814
592
  return {
@@ -971,7 +749,7 @@ const deserializeAws_json1_1CancelStatementResponse = (output, context) => {
971
749
  };
972
750
  };
973
751
  const deserializeAws_json1_1ColumnList = (output, context) => {
974
- return (output || [])
752
+ const retVal = (output || [])
975
753
  .filter((e) => e != null)
976
754
  .map((entry) => {
977
755
  if (entry === null) {
@@ -979,6 +757,7 @@ const deserializeAws_json1_1ColumnList = (output, context) => {
979
757
  }
980
758
  return deserializeAws_json1_1ColumnMetadata(entry, context);
981
759
  });
760
+ return retVal;
982
761
  };
983
762
  const deserializeAws_json1_1ColumnMetadata = (output, context) => {
984
763
  return {
@@ -998,7 +777,7 @@ const deserializeAws_json1_1ColumnMetadata = (output, context) => {
998
777
  };
999
778
  };
1000
779
  const deserializeAws_json1_1ColumnMetadataList = (output, context) => {
1001
- return (output || [])
780
+ const retVal = (output || [])
1002
781
  .filter((e) => e != null)
1003
782
  .map((entry) => {
1004
783
  if (entry === null) {
@@ -1006,6 +785,7 @@ const deserializeAws_json1_1ColumnMetadataList = (output, context) => {
1006
785
  }
1007
786
  return deserializeAws_json1_1ColumnMetadata(entry, context);
1008
787
  });
788
+ return retVal;
1009
789
  };
1010
790
  const deserializeAws_json1_1DatabaseConnectionException = (output, context) => {
1011
791
  return {
@@ -1013,7 +793,7 @@ const deserializeAws_json1_1DatabaseConnectionException = (output, context) => {
1013
793
  };
1014
794
  };
1015
795
  const deserializeAws_json1_1DatabaseList = (output, context) => {
1016
- return (output || [])
796
+ const retVal = (output || [])
1017
797
  .filter((e) => e != null)
1018
798
  .map((entry) => {
1019
799
  if (entry === null) {
@@ -1021,6 +801,7 @@ const deserializeAws_json1_1DatabaseList = (output, context) => {
1021
801
  }
1022
802
  return smithy_client_1.expectString(entry);
1023
803
  });
804
+ return retVal;
1024
805
  };
1025
806
  const deserializeAws_json1_1DescribeStatementResponse = (output, context) => {
1026
807
  return {
@@ -1103,7 +884,7 @@ const deserializeAws_json1_1Field = (output, context) => {
1103
884
  return { $unknown: Object.entries(output)[0] };
1104
885
  };
1105
886
  const deserializeAws_json1_1FieldList = (output, context) => {
1106
- return (output || [])
887
+ const retVal = (output || [])
1107
888
  .filter((e) => e != null)
1108
889
  .map((entry) => {
1109
890
  if (entry === null) {
@@ -1111,6 +892,7 @@ const deserializeAws_json1_1FieldList = (output, context) => {
1111
892
  }
1112
893
  return deserializeAws_json1_1Field(smithy_client_1.expectUnion(entry), context);
1113
894
  });
895
+ return retVal;
1114
896
  };
1115
897
  const deserializeAws_json1_1GetStatementResultResponse = (output, context) => {
1116
898
  return {
@@ -1168,7 +950,7 @@ const deserializeAws_json1_1ResourceNotFoundException = (output, context) => {
1168
950
  };
1169
951
  };
1170
952
  const deserializeAws_json1_1SchemaList = (output, context) => {
1171
- return (output || [])
953
+ const retVal = (output || [])
1172
954
  .filter((e) => e != null)
1173
955
  .map((entry) => {
1174
956
  if (entry === null) {
@@ -1176,6 +958,7 @@ const deserializeAws_json1_1SchemaList = (output, context) => {
1176
958
  }
1177
959
  return smithy_client_1.expectString(entry);
1178
960
  });
961
+ return retVal;
1179
962
  };
1180
963
  const deserializeAws_json1_1SqlParameter = (output, context) => {
1181
964
  return {
@@ -1184,7 +967,7 @@ const deserializeAws_json1_1SqlParameter = (output, context) => {
1184
967
  };
1185
968
  };
1186
969
  const deserializeAws_json1_1SqlParametersList = (output, context) => {
1187
- return (output || [])
970
+ const retVal = (output || [])
1188
971
  .filter((e) => e != null)
1189
972
  .map((entry) => {
1190
973
  if (entry === null) {
@@ -1192,9 +975,10 @@ const deserializeAws_json1_1SqlParametersList = (output, context) => {
1192
975
  }
1193
976
  return deserializeAws_json1_1SqlParameter(entry, context);
1194
977
  });
978
+ return retVal;
1195
979
  };
1196
980
  const deserializeAws_json1_1SqlRecords = (output, context) => {
1197
- return (output || [])
981
+ const retVal = (output || [])
1198
982
  .filter((e) => e != null)
1199
983
  .map((entry) => {
1200
984
  if (entry === null) {
@@ -1202,6 +986,7 @@ const deserializeAws_json1_1SqlRecords = (output, context) => {
1202
986
  }
1203
987
  return deserializeAws_json1_1FieldList(entry, context);
1204
988
  });
989
+ return retVal;
1205
990
  };
1206
991
  const deserializeAws_json1_1StatementData = (output, context) => {
1207
992
  return {
@@ -1226,7 +1011,7 @@ const deserializeAws_json1_1StatementData = (output, context) => {
1226
1011
  };
1227
1012
  };
1228
1013
  const deserializeAws_json1_1StatementList = (output, context) => {
1229
- return (output || [])
1014
+ const retVal = (output || [])
1230
1015
  .filter((e) => e != null)
1231
1016
  .map((entry) => {
1232
1017
  if (entry === null) {
@@ -1234,9 +1019,10 @@ const deserializeAws_json1_1StatementList = (output, context) => {
1234
1019
  }
1235
1020
  return deserializeAws_json1_1StatementData(entry, context);
1236
1021
  });
1022
+ return retVal;
1237
1023
  };
1238
1024
  const deserializeAws_json1_1StatementStringList = (output, context) => {
1239
- return (output || [])
1025
+ const retVal = (output || [])
1240
1026
  .filter((e) => e != null)
1241
1027
  .map((entry) => {
1242
1028
  if (entry === null) {
@@ -1244,6 +1030,7 @@ const deserializeAws_json1_1StatementStringList = (output, context) => {
1244
1030
  }
1245
1031
  return smithy_client_1.expectString(entry);
1246
1032
  });
1033
+ return retVal;
1247
1034
  };
1248
1035
  const deserializeAws_json1_1SubStatementData = (output, context) => {
1249
1036
  return {
@@ -1265,7 +1052,7 @@ const deserializeAws_json1_1SubStatementData = (output, context) => {
1265
1052
  };
1266
1053
  };
1267
1054
  const deserializeAws_json1_1SubStatementList = (output, context) => {
1268
- return (output || [])
1055
+ const retVal = (output || [])
1269
1056
  .filter((e) => e != null)
1270
1057
  .map((entry) => {
1271
1058
  if (entry === null) {
@@ -1273,9 +1060,10 @@ const deserializeAws_json1_1SubStatementList = (output, context) => {
1273
1060
  }
1274
1061
  return deserializeAws_json1_1SubStatementData(entry, context);
1275
1062
  });
1063
+ return retVal;
1276
1064
  };
1277
1065
  const deserializeAws_json1_1TableList = (output, context) => {
1278
- return (output || [])
1066
+ const retVal = (output || [])
1279
1067
  .filter((e) => e != null)
1280
1068
  .map((entry) => {
1281
1069
  if (entry === null) {
@@ -1283,6 +1071,7 @@ const deserializeAws_json1_1TableList = (output, context) => {
1283
1071
  }
1284
1072
  return deserializeAws_json1_1TableMember(entry, context);
1285
1073
  });
1074
+ return retVal;
1286
1075
  };
1287
1076
  const deserializeAws_json1_1TableMember = (output, context) => {
1288
1077
  return {