@aws-sdk/client-voice-id 3.52.0 → 3.54.1

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.
@@ -4,6 +4,8 @@ exports.deserializeAws_json1_0UpdateDomainCommand = exports.deserializeAws_json1
4
4
  const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const smithy_client_1 = require("@aws-sdk/smithy-client");
6
6
  const uuid_1 = require("uuid");
7
+ const models_0_1 = require("../models/models_0");
8
+ const VoiceIDServiceException_1 = require("../models/VoiceIDServiceException");
7
9
  const serializeAws_json1_0CreateDomainCommand = async (input, context) => {
8
10
  const headers = {
9
11
  "content-type": "application/x-amz-json-1.0",
@@ -239,75 +241,34 @@ const deserializeAws_json1_0CreateDomainCommandError = async (output, context) =
239
241
  switch (errorCode) {
240
242
  case "AccessDeniedException":
241
243
  case "com.amazonaws.voiceid#AccessDeniedException":
242
- response = {
243
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
244
- name: errorCode,
245
- $metadata: deserializeMetadata(output),
246
- };
247
- break;
244
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
248
245
  case "ConflictException":
249
246
  case "com.amazonaws.voiceid#ConflictException":
250
- response = {
251
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
252
- name: errorCode,
253
- $metadata: deserializeMetadata(output),
254
- };
255
- break;
247
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
256
248
  case "InternalServerException":
257
249
  case "com.amazonaws.voiceid#InternalServerException":
258
- response = {
259
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
260
- name: errorCode,
261
- $metadata: deserializeMetadata(output),
262
- };
263
- break;
250
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
264
251
  case "ResourceNotFoundException":
265
252
  case "com.amazonaws.voiceid#ResourceNotFoundException":
266
- response = {
267
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
268
- name: errorCode,
269
- $metadata: deserializeMetadata(output),
270
- };
271
- break;
253
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
272
254
  case "ServiceQuotaExceededException":
273
255
  case "com.amazonaws.voiceid#ServiceQuotaExceededException":
274
- response = {
275
- ...(await deserializeAws_json1_0ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
276
- name: errorCode,
277
- $metadata: deserializeMetadata(output),
278
- };
279
- break;
256
+ throw await deserializeAws_json1_0ServiceQuotaExceededExceptionResponse(parsedOutput, context);
280
257
  case "ThrottlingException":
281
258
  case "com.amazonaws.voiceid#ThrottlingException":
282
- response = {
283
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
284
- name: errorCode,
285
- $metadata: deserializeMetadata(output),
286
- };
287
- break;
259
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
288
260
  case "ValidationException":
289
261
  case "com.amazonaws.voiceid#ValidationException":
290
- response = {
291
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
292
- name: errorCode,
293
- $metadata: deserializeMetadata(output),
294
- };
295
- break;
262
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
296
263
  default:
297
264
  const parsedBody = parsedOutput.body;
298
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
299
- response = {
300
- ...parsedBody,
301
- name: `${errorCode}`,
302
- message: parsedBody.message || parsedBody.Message || errorCode,
265
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
266
+ name: parsedBody.code || parsedBody.Code || errorCode,
303
267
  $fault: "client",
304
268
  $metadata: deserializeMetadata(output),
305
- };
269
+ });
270
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
306
271
  }
307
- const message = response.message || response.Message || errorCode;
308
- response.message = message;
309
- delete response.Message;
310
- return Promise.reject(Object.assign(new Error(message), response));
311
272
  };
312
273
  const deserializeAws_json1_0DeleteDomainCommand = async (output, context) => {
313
274
  if (output.statusCode >= 300) {
@@ -331,67 +292,31 @@ const deserializeAws_json1_0DeleteDomainCommandError = async (output, context) =
331
292
  switch (errorCode) {
332
293
  case "AccessDeniedException":
333
294
  case "com.amazonaws.voiceid#AccessDeniedException":
334
- response = {
335
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
336
- name: errorCode,
337
- $metadata: deserializeMetadata(output),
338
- };
339
- break;
295
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
340
296
  case "ConflictException":
341
297
  case "com.amazonaws.voiceid#ConflictException":
342
- response = {
343
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
344
- name: errorCode,
345
- $metadata: deserializeMetadata(output),
346
- };
347
- break;
298
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
348
299
  case "InternalServerException":
349
300
  case "com.amazonaws.voiceid#InternalServerException":
350
- response = {
351
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
352
- name: errorCode,
353
- $metadata: deserializeMetadata(output),
354
- };
355
- break;
301
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
356
302
  case "ResourceNotFoundException":
357
303
  case "com.amazonaws.voiceid#ResourceNotFoundException":
358
- response = {
359
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
360
- name: errorCode,
361
- $metadata: deserializeMetadata(output),
362
- };
363
- break;
304
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
364
305
  case "ThrottlingException":
365
306
  case "com.amazonaws.voiceid#ThrottlingException":
366
- response = {
367
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
368
- name: errorCode,
369
- $metadata: deserializeMetadata(output),
370
- };
371
- break;
307
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
372
308
  case "ValidationException":
373
309
  case "com.amazonaws.voiceid#ValidationException":
374
- response = {
375
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
376
- name: errorCode,
377
- $metadata: deserializeMetadata(output),
378
- };
379
- break;
310
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
380
311
  default:
381
312
  const parsedBody = parsedOutput.body;
382
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
383
- response = {
384
- ...parsedBody,
385
- name: `${errorCode}`,
386
- message: parsedBody.message || parsedBody.Message || errorCode,
313
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
314
+ name: parsedBody.code || parsedBody.Code || errorCode,
387
315
  $fault: "client",
388
316
  $metadata: deserializeMetadata(output),
389
- };
317
+ });
318
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
390
319
  }
391
- const message = response.message || response.Message || errorCode;
392
- response.message = message;
393
- delete response.Message;
394
- return Promise.reject(Object.assign(new Error(message), response));
395
320
  };
396
321
  const deserializeAws_json1_0DeleteFraudsterCommand = async (output, context) => {
397
322
  if (output.statusCode >= 300) {
@@ -415,59 +340,28 @@ const deserializeAws_json1_0DeleteFraudsterCommandError = async (output, context
415
340
  switch (errorCode) {
416
341
  case "AccessDeniedException":
417
342
  case "com.amazonaws.voiceid#AccessDeniedException":
418
- response = {
419
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
420
- name: errorCode,
421
- $metadata: deserializeMetadata(output),
422
- };
423
- break;
343
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
424
344
  case "InternalServerException":
425
345
  case "com.amazonaws.voiceid#InternalServerException":
426
- response = {
427
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
428
- name: errorCode,
429
- $metadata: deserializeMetadata(output),
430
- };
431
- break;
346
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
432
347
  case "ResourceNotFoundException":
433
348
  case "com.amazonaws.voiceid#ResourceNotFoundException":
434
- response = {
435
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
436
- name: errorCode,
437
- $metadata: deserializeMetadata(output),
438
- };
439
- break;
349
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
440
350
  case "ThrottlingException":
441
351
  case "com.amazonaws.voiceid#ThrottlingException":
442
- response = {
443
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
444
- name: errorCode,
445
- $metadata: deserializeMetadata(output),
446
- };
447
- break;
352
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
448
353
  case "ValidationException":
449
354
  case "com.amazonaws.voiceid#ValidationException":
450
- response = {
451
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
452
- name: errorCode,
453
- $metadata: deserializeMetadata(output),
454
- };
455
- break;
355
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
456
356
  default:
457
357
  const parsedBody = parsedOutput.body;
458
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
459
- response = {
460
- ...parsedBody,
461
- name: `${errorCode}`,
462
- message: parsedBody.message || parsedBody.Message || errorCode,
358
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
359
+ name: parsedBody.code || parsedBody.Code || errorCode,
463
360
  $fault: "client",
464
361
  $metadata: deserializeMetadata(output),
465
- };
362
+ });
363
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
466
364
  }
467
- const message = response.message || response.Message || errorCode;
468
- response.message = message;
469
- delete response.Message;
470
- return Promise.reject(Object.assign(new Error(message), response));
471
365
  };
472
366
  const deserializeAws_json1_0DeleteSpeakerCommand = async (output, context) => {
473
367
  if (output.statusCode >= 300) {
@@ -491,67 +385,31 @@ const deserializeAws_json1_0DeleteSpeakerCommandError = async (output, context)
491
385
  switch (errorCode) {
492
386
  case "AccessDeniedException":
493
387
  case "com.amazonaws.voiceid#AccessDeniedException":
494
- response = {
495
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
496
- name: errorCode,
497
- $metadata: deserializeMetadata(output),
498
- };
499
- break;
388
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
500
389
  case "ConflictException":
501
390
  case "com.amazonaws.voiceid#ConflictException":
502
- response = {
503
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
504
- name: errorCode,
505
- $metadata: deserializeMetadata(output),
506
- };
507
- break;
391
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
508
392
  case "InternalServerException":
509
393
  case "com.amazonaws.voiceid#InternalServerException":
510
- response = {
511
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
512
- name: errorCode,
513
- $metadata: deserializeMetadata(output),
514
- };
515
- break;
394
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
516
395
  case "ResourceNotFoundException":
517
396
  case "com.amazonaws.voiceid#ResourceNotFoundException":
518
- response = {
519
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
520
- name: errorCode,
521
- $metadata: deserializeMetadata(output),
522
- };
523
- break;
397
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
524
398
  case "ThrottlingException":
525
399
  case "com.amazonaws.voiceid#ThrottlingException":
526
- response = {
527
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
528
- name: errorCode,
529
- $metadata: deserializeMetadata(output),
530
- };
531
- break;
400
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
532
401
  case "ValidationException":
533
402
  case "com.amazonaws.voiceid#ValidationException":
534
- response = {
535
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
536
- name: errorCode,
537
- $metadata: deserializeMetadata(output),
538
- };
539
- break;
403
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
540
404
  default:
541
405
  const parsedBody = parsedOutput.body;
542
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
543
- response = {
544
- ...parsedBody,
545
- name: `${errorCode}`,
546
- message: parsedBody.message || parsedBody.Message || errorCode,
406
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
407
+ name: parsedBody.code || parsedBody.Code || errorCode,
547
408
  $fault: "client",
548
409
  $metadata: deserializeMetadata(output),
549
- };
410
+ });
411
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
550
412
  }
551
- const message = response.message || response.Message || errorCode;
552
- response.message = message;
553
- delete response.Message;
554
- return Promise.reject(Object.assign(new Error(message), response));
555
413
  };
556
414
  const deserializeAws_json1_0DescribeDomainCommand = async (output, context) => {
557
415
  if (output.statusCode >= 300) {
@@ -578,59 +436,28 @@ const deserializeAws_json1_0DescribeDomainCommandError = async (output, context)
578
436
  switch (errorCode) {
579
437
  case "AccessDeniedException":
580
438
  case "com.amazonaws.voiceid#AccessDeniedException":
581
- response = {
582
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
583
- name: errorCode,
584
- $metadata: deserializeMetadata(output),
585
- };
586
- break;
439
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
587
440
  case "InternalServerException":
588
441
  case "com.amazonaws.voiceid#InternalServerException":
589
- response = {
590
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
591
- name: errorCode,
592
- $metadata: deserializeMetadata(output),
593
- };
594
- break;
442
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
595
443
  case "ResourceNotFoundException":
596
444
  case "com.amazonaws.voiceid#ResourceNotFoundException":
597
- response = {
598
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
599
- name: errorCode,
600
- $metadata: deserializeMetadata(output),
601
- };
602
- break;
445
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
603
446
  case "ThrottlingException":
604
447
  case "com.amazonaws.voiceid#ThrottlingException":
605
- response = {
606
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
607
- name: errorCode,
608
- $metadata: deserializeMetadata(output),
609
- };
610
- break;
448
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
611
449
  case "ValidationException":
612
450
  case "com.amazonaws.voiceid#ValidationException":
613
- response = {
614
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
615
- name: errorCode,
616
- $metadata: deserializeMetadata(output),
617
- };
618
- break;
451
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
619
452
  default:
620
453
  const parsedBody = parsedOutput.body;
621
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
622
- response = {
623
- ...parsedBody,
624
- name: `${errorCode}`,
625
- message: parsedBody.message || parsedBody.Message || errorCode,
454
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
455
+ name: parsedBody.code || parsedBody.Code || errorCode,
626
456
  $fault: "client",
627
457
  $metadata: deserializeMetadata(output),
628
- };
458
+ });
459
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
629
460
  }
630
- const message = response.message || response.Message || errorCode;
631
- response.message = message;
632
- delete response.Message;
633
- return Promise.reject(Object.assign(new Error(message), response));
634
461
  };
635
462
  const deserializeAws_json1_0DescribeFraudsterCommand = async (output, context) => {
636
463
  if (output.statusCode >= 300) {
@@ -657,59 +484,28 @@ const deserializeAws_json1_0DescribeFraudsterCommandError = async (output, conte
657
484
  switch (errorCode) {
658
485
  case "AccessDeniedException":
659
486
  case "com.amazonaws.voiceid#AccessDeniedException":
660
- response = {
661
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
662
- name: errorCode,
663
- $metadata: deserializeMetadata(output),
664
- };
665
- break;
487
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
666
488
  case "InternalServerException":
667
489
  case "com.amazonaws.voiceid#InternalServerException":
668
- response = {
669
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
670
- name: errorCode,
671
- $metadata: deserializeMetadata(output),
672
- };
673
- break;
490
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
674
491
  case "ResourceNotFoundException":
675
492
  case "com.amazonaws.voiceid#ResourceNotFoundException":
676
- response = {
677
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
678
- name: errorCode,
679
- $metadata: deserializeMetadata(output),
680
- };
681
- break;
493
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
682
494
  case "ThrottlingException":
683
495
  case "com.amazonaws.voiceid#ThrottlingException":
684
- response = {
685
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
686
- name: errorCode,
687
- $metadata: deserializeMetadata(output),
688
- };
689
- break;
496
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
690
497
  case "ValidationException":
691
498
  case "com.amazonaws.voiceid#ValidationException":
692
- response = {
693
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
694
- name: errorCode,
695
- $metadata: deserializeMetadata(output),
696
- };
697
- break;
499
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
698
500
  default:
699
501
  const parsedBody = parsedOutput.body;
700
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
701
- response = {
702
- ...parsedBody,
703
- name: `${errorCode}`,
704
- message: parsedBody.message || parsedBody.Message || errorCode,
502
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
503
+ name: parsedBody.code || parsedBody.Code || errorCode,
705
504
  $fault: "client",
706
505
  $metadata: deserializeMetadata(output),
707
- };
506
+ });
507
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
708
508
  }
709
- const message = response.message || response.Message || errorCode;
710
- response.message = message;
711
- delete response.Message;
712
- return Promise.reject(Object.assign(new Error(message), response));
713
509
  };
714
510
  const deserializeAws_json1_0DescribeFraudsterRegistrationJobCommand = async (output, context) => {
715
511
  if (output.statusCode >= 300) {
@@ -736,59 +532,28 @@ const deserializeAws_json1_0DescribeFraudsterRegistrationJobCommandError = async
736
532
  switch (errorCode) {
737
533
  case "AccessDeniedException":
738
534
  case "com.amazonaws.voiceid#AccessDeniedException":
739
- response = {
740
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
741
- name: errorCode,
742
- $metadata: deserializeMetadata(output),
743
- };
744
- break;
535
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
745
536
  case "InternalServerException":
746
537
  case "com.amazonaws.voiceid#InternalServerException":
747
- response = {
748
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
749
- name: errorCode,
750
- $metadata: deserializeMetadata(output),
751
- };
752
- break;
538
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
753
539
  case "ResourceNotFoundException":
754
540
  case "com.amazonaws.voiceid#ResourceNotFoundException":
755
- response = {
756
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
757
- name: errorCode,
758
- $metadata: deserializeMetadata(output),
759
- };
760
- break;
541
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
761
542
  case "ThrottlingException":
762
543
  case "com.amazonaws.voiceid#ThrottlingException":
763
- response = {
764
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
765
- name: errorCode,
766
- $metadata: deserializeMetadata(output),
767
- };
768
- break;
544
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
769
545
  case "ValidationException":
770
546
  case "com.amazonaws.voiceid#ValidationException":
771
- response = {
772
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
773
- name: errorCode,
774
- $metadata: deserializeMetadata(output),
775
- };
776
- break;
547
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
777
548
  default:
778
549
  const parsedBody = parsedOutput.body;
779
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
780
- response = {
781
- ...parsedBody,
782
- name: `${errorCode}`,
783
- message: parsedBody.message || parsedBody.Message || errorCode,
550
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
551
+ name: parsedBody.code || parsedBody.Code || errorCode,
784
552
  $fault: "client",
785
553
  $metadata: deserializeMetadata(output),
786
- };
554
+ });
555
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
787
556
  }
788
- const message = response.message || response.Message || errorCode;
789
- response.message = message;
790
- delete response.Message;
791
- return Promise.reject(Object.assign(new Error(message), response));
792
557
  };
793
558
  const deserializeAws_json1_0DescribeSpeakerCommand = async (output, context) => {
794
559
  if (output.statusCode >= 300) {
@@ -815,59 +580,28 @@ const deserializeAws_json1_0DescribeSpeakerCommandError = async (output, context
815
580
  switch (errorCode) {
816
581
  case "AccessDeniedException":
817
582
  case "com.amazonaws.voiceid#AccessDeniedException":
818
- response = {
819
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
820
- name: errorCode,
821
- $metadata: deserializeMetadata(output),
822
- };
823
- break;
583
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
824
584
  case "InternalServerException":
825
585
  case "com.amazonaws.voiceid#InternalServerException":
826
- response = {
827
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
828
- name: errorCode,
829
- $metadata: deserializeMetadata(output),
830
- };
831
- break;
586
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
832
587
  case "ResourceNotFoundException":
833
588
  case "com.amazonaws.voiceid#ResourceNotFoundException":
834
- response = {
835
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
836
- name: errorCode,
837
- $metadata: deserializeMetadata(output),
838
- };
839
- break;
589
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
840
590
  case "ThrottlingException":
841
591
  case "com.amazonaws.voiceid#ThrottlingException":
842
- response = {
843
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
844
- name: errorCode,
845
- $metadata: deserializeMetadata(output),
846
- };
847
- break;
592
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
848
593
  case "ValidationException":
849
594
  case "com.amazonaws.voiceid#ValidationException":
850
- response = {
851
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
852
- name: errorCode,
853
- $metadata: deserializeMetadata(output),
854
- };
855
- break;
595
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
856
596
  default:
857
597
  const parsedBody = parsedOutput.body;
858
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
859
- response = {
860
- ...parsedBody,
861
- name: `${errorCode}`,
862
- message: parsedBody.message || parsedBody.Message || errorCode,
598
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
599
+ name: parsedBody.code || parsedBody.Code || errorCode,
863
600
  $fault: "client",
864
601
  $metadata: deserializeMetadata(output),
865
- };
602
+ });
603
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
866
604
  }
867
- const message = response.message || response.Message || errorCode;
868
- response.message = message;
869
- delete response.Message;
870
- return Promise.reject(Object.assign(new Error(message), response));
871
605
  };
872
606
  const deserializeAws_json1_0DescribeSpeakerEnrollmentJobCommand = async (output, context) => {
873
607
  if (output.statusCode >= 300) {
@@ -894,59 +628,28 @@ const deserializeAws_json1_0DescribeSpeakerEnrollmentJobCommandError = async (ou
894
628
  switch (errorCode) {
895
629
  case "AccessDeniedException":
896
630
  case "com.amazonaws.voiceid#AccessDeniedException":
897
- response = {
898
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
899
- name: errorCode,
900
- $metadata: deserializeMetadata(output),
901
- };
902
- break;
631
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
903
632
  case "InternalServerException":
904
633
  case "com.amazonaws.voiceid#InternalServerException":
905
- response = {
906
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
907
- name: errorCode,
908
- $metadata: deserializeMetadata(output),
909
- };
910
- break;
634
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
911
635
  case "ResourceNotFoundException":
912
636
  case "com.amazonaws.voiceid#ResourceNotFoundException":
913
- response = {
914
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
915
- name: errorCode,
916
- $metadata: deserializeMetadata(output),
917
- };
918
- break;
637
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
919
638
  case "ThrottlingException":
920
639
  case "com.amazonaws.voiceid#ThrottlingException":
921
- response = {
922
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
923
- name: errorCode,
924
- $metadata: deserializeMetadata(output),
925
- };
926
- break;
640
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
927
641
  case "ValidationException":
928
642
  case "com.amazonaws.voiceid#ValidationException":
929
- response = {
930
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
931
- name: errorCode,
932
- $metadata: deserializeMetadata(output),
933
- };
934
- break;
643
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
935
644
  default:
936
645
  const parsedBody = parsedOutput.body;
937
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
938
- response = {
939
- ...parsedBody,
940
- name: `${errorCode}`,
941
- message: parsedBody.message || parsedBody.Message || errorCode,
646
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
647
+ name: parsedBody.code || parsedBody.Code || errorCode,
942
648
  $fault: "client",
943
649
  $metadata: deserializeMetadata(output),
944
- };
650
+ });
651
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
945
652
  }
946
- const message = response.message || response.Message || errorCode;
947
- response.message = message;
948
- delete response.Message;
949
- return Promise.reject(Object.assign(new Error(message), response));
950
653
  };
951
654
  const deserializeAws_json1_0EvaluateSessionCommand = async (output, context) => {
952
655
  if (output.statusCode >= 300) {
@@ -973,59 +676,28 @@ const deserializeAws_json1_0EvaluateSessionCommandError = async (output, context
973
676
  switch (errorCode) {
974
677
  case "AccessDeniedException":
975
678
  case "com.amazonaws.voiceid#AccessDeniedException":
976
- response = {
977
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
978
- name: errorCode,
979
- $metadata: deserializeMetadata(output),
980
- };
981
- break;
679
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
982
680
  case "InternalServerException":
983
681
  case "com.amazonaws.voiceid#InternalServerException":
984
- response = {
985
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
986
- name: errorCode,
987
- $metadata: deserializeMetadata(output),
988
- };
989
- break;
682
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
990
683
  case "ResourceNotFoundException":
991
684
  case "com.amazonaws.voiceid#ResourceNotFoundException":
992
- response = {
993
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
994
- name: errorCode,
995
- $metadata: deserializeMetadata(output),
996
- };
997
- break;
685
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
998
686
  case "ThrottlingException":
999
687
  case "com.amazonaws.voiceid#ThrottlingException":
1000
- response = {
1001
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1002
- name: errorCode,
1003
- $metadata: deserializeMetadata(output),
1004
- };
1005
- break;
688
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1006
689
  case "ValidationException":
1007
690
  case "com.amazonaws.voiceid#ValidationException":
1008
- response = {
1009
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1010
- name: errorCode,
1011
- $metadata: deserializeMetadata(output),
1012
- };
1013
- break;
691
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1014
692
  default:
1015
693
  const parsedBody = parsedOutput.body;
1016
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1017
- response = {
1018
- ...parsedBody,
1019
- name: `${errorCode}`,
1020
- message: parsedBody.message || parsedBody.Message || errorCode,
694
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
695
+ name: parsedBody.code || parsedBody.Code || errorCode,
1021
696
  $fault: "client",
1022
697
  $metadata: deserializeMetadata(output),
1023
- };
698
+ });
699
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1024
700
  }
1025
- const message = response.message || response.Message || errorCode;
1026
- response.message = message;
1027
- delete response.Message;
1028
- return Promise.reject(Object.assign(new Error(message), response));
1029
701
  };
1030
702
  const deserializeAws_json1_0ListDomainsCommand = async (output, context) => {
1031
703
  if (output.statusCode >= 300) {
@@ -1052,51 +724,25 @@ const deserializeAws_json1_0ListDomainsCommandError = async (output, context) =>
1052
724
  switch (errorCode) {
1053
725
  case "AccessDeniedException":
1054
726
  case "com.amazonaws.voiceid#AccessDeniedException":
1055
- response = {
1056
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1057
- name: errorCode,
1058
- $metadata: deserializeMetadata(output),
1059
- };
1060
- break;
727
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1061
728
  case "InternalServerException":
1062
729
  case "com.amazonaws.voiceid#InternalServerException":
1063
- response = {
1064
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1065
- name: errorCode,
1066
- $metadata: deserializeMetadata(output),
1067
- };
1068
- break;
730
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1069
731
  case "ThrottlingException":
1070
732
  case "com.amazonaws.voiceid#ThrottlingException":
1071
- response = {
1072
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1073
- name: errorCode,
1074
- $metadata: deserializeMetadata(output),
1075
- };
1076
- break;
733
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1077
734
  case "ValidationException":
1078
735
  case "com.amazonaws.voiceid#ValidationException":
1079
- response = {
1080
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1081
- name: errorCode,
1082
- $metadata: deserializeMetadata(output),
1083
- };
1084
- break;
736
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1085
737
  default:
1086
738
  const parsedBody = parsedOutput.body;
1087
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1088
- response = {
1089
- ...parsedBody,
1090
- name: `${errorCode}`,
1091
- message: parsedBody.message || parsedBody.Message || errorCode,
739
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
740
+ name: parsedBody.code || parsedBody.Code || errorCode,
1092
741
  $fault: "client",
1093
742
  $metadata: deserializeMetadata(output),
1094
- };
743
+ });
744
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1095
745
  }
1096
- const message = response.message || response.Message || errorCode;
1097
- response.message = message;
1098
- delete response.Message;
1099
- return Promise.reject(Object.assign(new Error(message), response));
1100
746
  };
1101
747
  const deserializeAws_json1_0ListFraudsterRegistrationJobsCommand = async (output, context) => {
1102
748
  if (output.statusCode >= 300) {
@@ -1123,59 +769,28 @@ const deserializeAws_json1_0ListFraudsterRegistrationJobsCommandError = async (o
1123
769
  switch (errorCode) {
1124
770
  case "AccessDeniedException":
1125
771
  case "com.amazonaws.voiceid#AccessDeniedException":
1126
- response = {
1127
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1128
- name: errorCode,
1129
- $metadata: deserializeMetadata(output),
1130
- };
1131
- break;
772
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1132
773
  case "InternalServerException":
1133
774
  case "com.amazonaws.voiceid#InternalServerException":
1134
- response = {
1135
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1136
- name: errorCode,
1137
- $metadata: deserializeMetadata(output),
1138
- };
1139
- break;
775
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1140
776
  case "ResourceNotFoundException":
1141
777
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1142
- response = {
1143
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1144
- name: errorCode,
1145
- $metadata: deserializeMetadata(output),
1146
- };
1147
- break;
778
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1148
779
  case "ThrottlingException":
1149
780
  case "com.amazonaws.voiceid#ThrottlingException":
1150
- response = {
1151
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1152
- name: errorCode,
1153
- $metadata: deserializeMetadata(output),
1154
- };
1155
- break;
781
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1156
782
  case "ValidationException":
1157
783
  case "com.amazonaws.voiceid#ValidationException":
1158
- response = {
1159
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1160
- name: errorCode,
1161
- $metadata: deserializeMetadata(output),
1162
- };
1163
- break;
784
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1164
785
  default:
1165
786
  const parsedBody = parsedOutput.body;
1166
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1167
- response = {
1168
- ...parsedBody,
1169
- name: `${errorCode}`,
1170
- message: parsedBody.message || parsedBody.Message || errorCode,
787
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
788
+ name: parsedBody.code || parsedBody.Code || errorCode,
1171
789
  $fault: "client",
1172
790
  $metadata: deserializeMetadata(output),
1173
- };
791
+ });
792
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1174
793
  }
1175
- const message = response.message || response.Message || errorCode;
1176
- response.message = message;
1177
- delete response.Message;
1178
- return Promise.reject(Object.assign(new Error(message), response));
1179
794
  };
1180
795
  const deserializeAws_json1_0ListSpeakerEnrollmentJobsCommand = async (output, context) => {
1181
796
  if (output.statusCode >= 300) {
@@ -1202,59 +817,28 @@ const deserializeAws_json1_0ListSpeakerEnrollmentJobsCommandError = async (outpu
1202
817
  switch (errorCode) {
1203
818
  case "AccessDeniedException":
1204
819
  case "com.amazonaws.voiceid#AccessDeniedException":
1205
- response = {
1206
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1207
- name: errorCode,
1208
- $metadata: deserializeMetadata(output),
1209
- };
1210
- break;
820
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1211
821
  case "InternalServerException":
1212
822
  case "com.amazonaws.voiceid#InternalServerException":
1213
- response = {
1214
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1215
- name: errorCode,
1216
- $metadata: deserializeMetadata(output),
1217
- };
1218
- break;
823
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1219
824
  case "ResourceNotFoundException":
1220
825
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1221
- response = {
1222
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1223
- name: errorCode,
1224
- $metadata: deserializeMetadata(output),
1225
- };
1226
- break;
826
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1227
827
  case "ThrottlingException":
1228
828
  case "com.amazonaws.voiceid#ThrottlingException":
1229
- response = {
1230
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1231
- name: errorCode,
1232
- $metadata: deserializeMetadata(output),
1233
- };
1234
- break;
829
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1235
830
  case "ValidationException":
1236
831
  case "com.amazonaws.voiceid#ValidationException":
1237
- response = {
1238
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1239
- name: errorCode,
1240
- $metadata: deserializeMetadata(output),
1241
- };
1242
- break;
832
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1243
833
  default:
1244
834
  const parsedBody = parsedOutput.body;
1245
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1246
- response = {
1247
- ...parsedBody,
1248
- name: `${errorCode}`,
1249
- message: parsedBody.message || parsedBody.Message || errorCode,
835
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
836
+ name: parsedBody.code || parsedBody.Code || errorCode,
1250
837
  $fault: "client",
1251
838
  $metadata: deserializeMetadata(output),
1252
- };
839
+ });
840
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1253
841
  }
1254
- const message = response.message || response.Message || errorCode;
1255
- response.message = message;
1256
- delete response.Message;
1257
- return Promise.reject(Object.assign(new Error(message), response));
1258
842
  };
1259
843
  const deserializeAws_json1_0ListSpeakersCommand = async (output, context) => {
1260
844
  if (output.statusCode >= 300) {
@@ -1281,59 +865,28 @@ const deserializeAws_json1_0ListSpeakersCommandError = async (output, context) =
1281
865
  switch (errorCode) {
1282
866
  case "AccessDeniedException":
1283
867
  case "com.amazonaws.voiceid#AccessDeniedException":
1284
- response = {
1285
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1286
- name: errorCode,
1287
- $metadata: deserializeMetadata(output),
1288
- };
1289
- break;
868
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1290
869
  case "InternalServerException":
1291
870
  case "com.amazonaws.voiceid#InternalServerException":
1292
- response = {
1293
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1294
- name: errorCode,
1295
- $metadata: deserializeMetadata(output),
1296
- };
1297
- break;
871
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1298
872
  case "ResourceNotFoundException":
1299
873
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1300
- response = {
1301
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1302
- name: errorCode,
1303
- $metadata: deserializeMetadata(output),
1304
- };
1305
- break;
874
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1306
875
  case "ThrottlingException":
1307
876
  case "com.amazonaws.voiceid#ThrottlingException":
1308
- response = {
1309
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1310
- name: errorCode,
1311
- $metadata: deserializeMetadata(output),
1312
- };
1313
- break;
877
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1314
878
  case "ValidationException":
1315
879
  case "com.amazonaws.voiceid#ValidationException":
1316
- response = {
1317
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1318
- name: errorCode,
1319
- $metadata: deserializeMetadata(output),
1320
- };
1321
- break;
880
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1322
881
  default:
1323
882
  const parsedBody = parsedOutput.body;
1324
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1325
- response = {
1326
- ...parsedBody,
1327
- name: `${errorCode}`,
1328
- message: parsedBody.message || parsedBody.Message || errorCode,
883
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
884
+ name: parsedBody.code || parsedBody.Code || errorCode,
1329
885
  $fault: "client",
1330
886
  $metadata: deserializeMetadata(output),
1331
- };
887
+ });
888
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1332
889
  }
1333
- const message = response.message || response.Message || errorCode;
1334
- response.message = message;
1335
- delete response.Message;
1336
- return Promise.reject(Object.assign(new Error(message), response));
1337
890
  };
1338
891
  const deserializeAws_json1_0ListTagsForResourceCommand = async (output, context) => {
1339
892
  if (output.statusCode >= 300) {
@@ -1360,59 +913,28 @@ const deserializeAws_json1_0ListTagsForResourceCommandError = async (output, con
1360
913
  switch (errorCode) {
1361
914
  case "AccessDeniedException":
1362
915
  case "com.amazonaws.voiceid#AccessDeniedException":
1363
- response = {
1364
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1365
- name: errorCode,
1366
- $metadata: deserializeMetadata(output),
1367
- };
1368
- break;
916
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1369
917
  case "InternalServerException":
1370
918
  case "com.amazonaws.voiceid#InternalServerException":
1371
- response = {
1372
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1373
- name: errorCode,
1374
- $metadata: deserializeMetadata(output),
1375
- };
1376
- break;
919
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1377
920
  case "ResourceNotFoundException":
1378
921
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1379
- response = {
1380
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1381
- name: errorCode,
1382
- $metadata: deserializeMetadata(output),
1383
- };
1384
- break;
922
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1385
923
  case "ThrottlingException":
1386
924
  case "com.amazonaws.voiceid#ThrottlingException":
1387
- response = {
1388
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1389
- name: errorCode,
1390
- $metadata: deserializeMetadata(output),
1391
- };
1392
- break;
925
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1393
926
  case "ValidationException":
1394
927
  case "com.amazonaws.voiceid#ValidationException":
1395
- response = {
1396
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1397
- name: errorCode,
1398
- $metadata: deserializeMetadata(output),
1399
- };
1400
- break;
928
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1401
929
  default:
1402
930
  const parsedBody = parsedOutput.body;
1403
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1404
- response = {
1405
- ...parsedBody,
1406
- name: `${errorCode}`,
1407
- message: parsedBody.message || parsedBody.Message || errorCode,
931
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
932
+ name: parsedBody.code || parsedBody.Code || errorCode,
1408
933
  $fault: "client",
1409
934
  $metadata: deserializeMetadata(output),
1410
- };
935
+ });
936
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1411
937
  }
1412
- const message = response.message || response.Message || errorCode;
1413
- response.message = message;
1414
- delete response.Message;
1415
- return Promise.reject(Object.assign(new Error(message), response));
1416
938
  };
1417
939
  const deserializeAws_json1_0OptOutSpeakerCommand = async (output, context) => {
1418
940
  if (output.statusCode >= 300) {
@@ -1439,67 +961,31 @@ const deserializeAws_json1_0OptOutSpeakerCommandError = async (output, context)
1439
961
  switch (errorCode) {
1440
962
  case "AccessDeniedException":
1441
963
  case "com.amazonaws.voiceid#AccessDeniedException":
1442
- response = {
1443
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1444
- name: errorCode,
1445
- $metadata: deserializeMetadata(output),
1446
- };
1447
- break;
964
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1448
965
  case "ConflictException":
1449
966
  case "com.amazonaws.voiceid#ConflictException":
1450
- response = {
1451
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
1452
- name: errorCode,
1453
- $metadata: deserializeMetadata(output),
1454
- };
1455
- break;
967
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
1456
968
  case "InternalServerException":
1457
969
  case "com.amazonaws.voiceid#InternalServerException":
1458
- response = {
1459
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1460
- name: errorCode,
1461
- $metadata: deserializeMetadata(output),
1462
- };
1463
- break;
970
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1464
971
  case "ResourceNotFoundException":
1465
972
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1466
- response = {
1467
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1468
- name: errorCode,
1469
- $metadata: deserializeMetadata(output),
1470
- };
1471
- break;
973
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1472
974
  case "ThrottlingException":
1473
975
  case "com.amazonaws.voiceid#ThrottlingException":
1474
- response = {
1475
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1476
- name: errorCode,
1477
- $metadata: deserializeMetadata(output),
1478
- };
1479
- break;
976
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1480
977
  case "ValidationException":
1481
978
  case "com.amazonaws.voiceid#ValidationException":
1482
- response = {
1483
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1484
- name: errorCode,
1485
- $metadata: deserializeMetadata(output),
1486
- };
1487
- break;
979
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1488
980
  default:
1489
981
  const parsedBody = parsedOutput.body;
1490
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1491
- response = {
1492
- ...parsedBody,
1493
- name: `${errorCode}`,
1494
- message: parsedBody.message || parsedBody.Message || errorCode,
982
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
983
+ name: parsedBody.code || parsedBody.Code || errorCode,
1495
984
  $fault: "client",
1496
985
  $metadata: deserializeMetadata(output),
1497
- };
986
+ });
987
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1498
988
  }
1499
- const message = response.message || response.Message || errorCode;
1500
- response.message = message;
1501
- delete response.Message;
1502
- return Promise.reject(Object.assign(new Error(message), response));
1503
989
  };
1504
990
  const deserializeAws_json1_0StartFraudsterRegistrationJobCommand = async (output, context) => {
1505
991
  if (output.statusCode >= 300) {
@@ -1526,75 +1012,34 @@ const deserializeAws_json1_0StartFraudsterRegistrationJobCommandError = async (o
1526
1012
  switch (errorCode) {
1527
1013
  case "AccessDeniedException":
1528
1014
  case "com.amazonaws.voiceid#AccessDeniedException":
1529
- response = {
1530
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1531
- name: errorCode,
1532
- $metadata: deserializeMetadata(output),
1533
- };
1534
- break;
1015
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1535
1016
  case "ConflictException":
1536
1017
  case "com.amazonaws.voiceid#ConflictException":
1537
- response = {
1538
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
1539
- name: errorCode,
1540
- $metadata: deserializeMetadata(output),
1541
- };
1542
- break;
1018
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
1543
1019
  case "InternalServerException":
1544
1020
  case "com.amazonaws.voiceid#InternalServerException":
1545
- response = {
1546
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1547
- name: errorCode,
1548
- $metadata: deserializeMetadata(output),
1549
- };
1550
- break;
1021
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1551
1022
  case "ResourceNotFoundException":
1552
1023
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1553
- response = {
1554
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1555
- name: errorCode,
1556
- $metadata: deserializeMetadata(output),
1557
- };
1558
- break;
1024
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1559
1025
  case "ServiceQuotaExceededException":
1560
1026
  case "com.amazonaws.voiceid#ServiceQuotaExceededException":
1561
- response = {
1562
- ...(await deserializeAws_json1_0ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1563
- name: errorCode,
1564
- $metadata: deserializeMetadata(output),
1565
- };
1566
- break;
1027
+ throw await deserializeAws_json1_0ServiceQuotaExceededExceptionResponse(parsedOutput, context);
1567
1028
  case "ThrottlingException":
1568
1029
  case "com.amazonaws.voiceid#ThrottlingException":
1569
- response = {
1570
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1571
- name: errorCode,
1572
- $metadata: deserializeMetadata(output),
1573
- };
1574
- break;
1030
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1575
1031
  case "ValidationException":
1576
1032
  case "com.amazonaws.voiceid#ValidationException":
1577
- response = {
1578
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1579
- name: errorCode,
1580
- $metadata: deserializeMetadata(output),
1581
- };
1582
- break;
1033
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1583
1034
  default:
1584
1035
  const parsedBody = parsedOutput.body;
1585
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1586
- response = {
1587
- ...parsedBody,
1588
- name: `${errorCode}`,
1589
- message: parsedBody.message || parsedBody.Message || errorCode,
1036
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
1037
+ name: parsedBody.code || parsedBody.Code || errorCode,
1590
1038
  $fault: "client",
1591
1039
  $metadata: deserializeMetadata(output),
1592
- };
1040
+ });
1041
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1593
1042
  }
1594
- const message = response.message || response.Message || errorCode;
1595
- response.message = message;
1596
- delete response.Message;
1597
- return Promise.reject(Object.assign(new Error(message), response));
1598
1043
  };
1599
1044
  const deserializeAws_json1_0StartSpeakerEnrollmentJobCommand = async (output, context) => {
1600
1045
  if (output.statusCode >= 300) {
@@ -1621,75 +1066,34 @@ const deserializeAws_json1_0StartSpeakerEnrollmentJobCommandError = async (outpu
1621
1066
  switch (errorCode) {
1622
1067
  case "AccessDeniedException":
1623
1068
  case "com.amazonaws.voiceid#AccessDeniedException":
1624
- response = {
1625
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1626
- name: errorCode,
1627
- $metadata: deserializeMetadata(output),
1628
- };
1629
- break;
1069
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1630
1070
  case "ConflictException":
1631
1071
  case "com.amazonaws.voiceid#ConflictException":
1632
- response = {
1633
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
1634
- name: errorCode,
1635
- $metadata: deserializeMetadata(output),
1636
- };
1637
- break;
1072
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
1638
1073
  case "InternalServerException":
1639
1074
  case "com.amazonaws.voiceid#InternalServerException":
1640
- response = {
1641
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1642
- name: errorCode,
1643
- $metadata: deserializeMetadata(output),
1644
- };
1645
- break;
1075
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1646
1076
  case "ResourceNotFoundException":
1647
1077
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1648
- response = {
1649
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1650
- name: errorCode,
1651
- $metadata: deserializeMetadata(output),
1652
- };
1653
- break;
1078
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1654
1079
  case "ServiceQuotaExceededException":
1655
1080
  case "com.amazonaws.voiceid#ServiceQuotaExceededException":
1656
- response = {
1657
- ...(await deserializeAws_json1_0ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
1658
- name: errorCode,
1659
- $metadata: deserializeMetadata(output),
1660
- };
1661
- break;
1081
+ throw await deserializeAws_json1_0ServiceQuotaExceededExceptionResponse(parsedOutput, context);
1662
1082
  case "ThrottlingException":
1663
1083
  case "com.amazonaws.voiceid#ThrottlingException":
1664
- response = {
1665
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1666
- name: errorCode,
1667
- $metadata: deserializeMetadata(output),
1668
- };
1669
- break;
1084
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1670
1085
  case "ValidationException":
1671
1086
  case "com.amazonaws.voiceid#ValidationException":
1672
- response = {
1673
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1674
- name: errorCode,
1675
- $metadata: deserializeMetadata(output),
1676
- };
1677
- break;
1087
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1678
1088
  default:
1679
1089
  const parsedBody = parsedOutput.body;
1680
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1681
- response = {
1682
- ...parsedBody,
1683
- name: `${errorCode}`,
1684
- message: parsedBody.message || parsedBody.Message || errorCode,
1090
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
1091
+ name: parsedBody.code || parsedBody.Code || errorCode,
1685
1092
  $fault: "client",
1686
1093
  $metadata: deserializeMetadata(output),
1687
- };
1094
+ });
1095
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1688
1096
  }
1689
- const message = response.message || response.Message || errorCode;
1690
- response.message = message;
1691
- delete response.Message;
1692
- return Promise.reject(Object.assign(new Error(message), response));
1693
1097
  };
1694
1098
  const deserializeAws_json1_0TagResourceCommand = async (output, context) => {
1695
1099
  if (output.statusCode >= 300) {
@@ -1716,67 +1120,31 @@ const deserializeAws_json1_0TagResourceCommandError = async (output, context) =>
1716
1120
  switch (errorCode) {
1717
1121
  case "AccessDeniedException":
1718
1122
  case "com.amazonaws.voiceid#AccessDeniedException":
1719
- response = {
1720
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1721
- name: errorCode,
1722
- $metadata: deserializeMetadata(output),
1723
- };
1724
- break;
1123
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1725
1124
  case "ConflictException":
1726
1125
  case "com.amazonaws.voiceid#ConflictException":
1727
- response = {
1728
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
1729
- name: errorCode,
1730
- $metadata: deserializeMetadata(output),
1731
- };
1732
- break;
1126
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
1733
1127
  case "InternalServerException":
1734
1128
  case "com.amazonaws.voiceid#InternalServerException":
1735
- response = {
1736
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1737
- name: errorCode,
1738
- $metadata: deserializeMetadata(output),
1739
- };
1740
- break;
1129
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1741
1130
  case "ResourceNotFoundException":
1742
1131
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1743
- response = {
1744
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1745
- name: errorCode,
1746
- $metadata: deserializeMetadata(output),
1747
- };
1748
- break;
1132
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1749
1133
  case "ThrottlingException":
1750
1134
  case "com.amazonaws.voiceid#ThrottlingException":
1751
- response = {
1752
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1753
- name: errorCode,
1754
- $metadata: deserializeMetadata(output),
1755
- };
1756
- break;
1135
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1757
1136
  case "ValidationException":
1758
1137
  case "com.amazonaws.voiceid#ValidationException":
1759
- response = {
1760
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1761
- name: errorCode,
1762
- $metadata: deserializeMetadata(output),
1763
- };
1764
- break;
1138
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1765
1139
  default:
1766
1140
  const parsedBody = parsedOutput.body;
1767
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1768
- response = {
1769
- ...parsedBody,
1770
- name: `${errorCode}`,
1771
- message: parsedBody.message || parsedBody.Message || errorCode,
1141
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
1142
+ name: parsedBody.code || parsedBody.Code || errorCode,
1772
1143
  $fault: "client",
1773
1144
  $metadata: deserializeMetadata(output),
1774
- };
1145
+ });
1146
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1775
1147
  }
1776
- const message = response.message || response.Message || errorCode;
1777
- response.message = message;
1778
- delete response.Message;
1779
- return Promise.reject(Object.assign(new Error(message), response));
1780
1148
  };
1781
1149
  const deserializeAws_json1_0UntagResourceCommand = async (output, context) => {
1782
1150
  if (output.statusCode >= 300) {
@@ -1803,67 +1171,31 @@ const deserializeAws_json1_0UntagResourceCommandError = async (output, context)
1803
1171
  switch (errorCode) {
1804
1172
  case "AccessDeniedException":
1805
1173
  case "com.amazonaws.voiceid#AccessDeniedException":
1806
- response = {
1807
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1808
- name: errorCode,
1809
- $metadata: deserializeMetadata(output),
1810
- };
1811
- break;
1174
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1812
1175
  case "ConflictException":
1813
1176
  case "com.amazonaws.voiceid#ConflictException":
1814
- response = {
1815
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
1816
- name: errorCode,
1817
- $metadata: deserializeMetadata(output),
1818
- };
1819
- break;
1177
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
1820
1178
  case "InternalServerException":
1821
1179
  case "com.amazonaws.voiceid#InternalServerException":
1822
- response = {
1823
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1824
- name: errorCode,
1825
- $metadata: deserializeMetadata(output),
1826
- };
1827
- break;
1180
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1828
1181
  case "ResourceNotFoundException":
1829
1182
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1830
- response = {
1831
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1832
- name: errorCode,
1833
- $metadata: deserializeMetadata(output),
1834
- };
1835
- break;
1183
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1836
1184
  case "ThrottlingException":
1837
1185
  case "com.amazonaws.voiceid#ThrottlingException":
1838
- response = {
1839
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1840
- name: errorCode,
1841
- $metadata: deserializeMetadata(output),
1842
- };
1843
- break;
1186
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1844
1187
  case "ValidationException":
1845
1188
  case "com.amazonaws.voiceid#ValidationException":
1846
- response = {
1847
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1848
- name: errorCode,
1849
- $metadata: deserializeMetadata(output),
1850
- };
1851
- break;
1189
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1852
1190
  default:
1853
1191
  const parsedBody = parsedOutput.body;
1854
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1855
- response = {
1856
- ...parsedBody,
1857
- name: `${errorCode}`,
1858
- message: parsedBody.message || parsedBody.Message || errorCode,
1192
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
1193
+ name: parsedBody.code || parsedBody.Code || errorCode,
1859
1194
  $fault: "client",
1860
1195
  $metadata: deserializeMetadata(output),
1861
- };
1196
+ });
1197
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1862
1198
  }
1863
- const message = response.message || response.Message || errorCode;
1864
- response.message = message;
1865
- delete response.Message;
1866
- return Promise.reject(Object.assign(new Error(message), response));
1867
1199
  };
1868
1200
  const deserializeAws_json1_0UpdateDomainCommand = async (output, context) => {
1869
1201
  if (output.statusCode >= 300) {
@@ -1890,144 +1222,94 @@ const deserializeAws_json1_0UpdateDomainCommandError = async (output, context) =
1890
1222
  switch (errorCode) {
1891
1223
  case "AccessDeniedException":
1892
1224
  case "com.amazonaws.voiceid#AccessDeniedException":
1893
- response = {
1894
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
1895
- name: errorCode,
1896
- $metadata: deserializeMetadata(output),
1897
- };
1898
- break;
1225
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
1899
1226
  case "ConflictException":
1900
1227
  case "com.amazonaws.voiceid#ConflictException":
1901
- response = {
1902
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
1903
- name: errorCode,
1904
- $metadata: deserializeMetadata(output),
1905
- };
1906
- break;
1228
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
1907
1229
  case "InternalServerException":
1908
1230
  case "com.amazonaws.voiceid#InternalServerException":
1909
- response = {
1910
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
1911
- name: errorCode,
1912
- $metadata: deserializeMetadata(output),
1913
- };
1914
- break;
1231
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
1915
1232
  case "ResourceNotFoundException":
1916
1233
  case "com.amazonaws.voiceid#ResourceNotFoundException":
1917
- response = {
1918
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1919
- name: errorCode,
1920
- $metadata: deserializeMetadata(output),
1921
- };
1922
- break;
1234
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1923
1235
  case "ThrottlingException":
1924
1236
  case "com.amazonaws.voiceid#ThrottlingException":
1925
- response = {
1926
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
1927
- name: errorCode,
1928
- $metadata: deserializeMetadata(output),
1929
- };
1930
- break;
1237
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
1931
1238
  case "ValidationException":
1932
1239
  case "com.amazonaws.voiceid#ValidationException":
1933
- response = {
1934
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1935
- name: errorCode,
1936
- $metadata: deserializeMetadata(output),
1937
- };
1938
- break;
1240
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1939
1241
  default:
1940
1242
  const parsedBody = parsedOutput.body;
1941
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1942
- response = {
1943
- ...parsedBody,
1944
- name: `${errorCode}`,
1945
- message: parsedBody.message || parsedBody.Message || errorCode,
1243
+ response = new VoiceIDServiceException_1.VoiceIDServiceException({
1244
+ name: parsedBody.code || parsedBody.Code || errorCode,
1946
1245
  $fault: "client",
1947
1246
  $metadata: deserializeMetadata(output),
1948
- };
1247
+ });
1248
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1949
1249
  }
1950
- const message = response.message || response.Message || errorCode;
1951
- response.message = message;
1952
- delete response.Message;
1953
- return Promise.reject(Object.assign(new Error(message), response));
1954
1250
  };
1955
1251
  const deserializeAws_json1_0AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1956
1252
  const body = parsedOutput.body;
1957
1253
  const deserialized = deserializeAws_json1_0AccessDeniedException(body, context);
1958
- const contents = {
1959
- name: "AccessDeniedException",
1960
- $fault: "client",
1254
+ const exception = new models_0_1.AccessDeniedException({
1961
1255
  $metadata: deserializeMetadata(parsedOutput),
1962
1256
  ...deserialized,
1963
- };
1964
- return contents;
1257
+ });
1258
+ return smithy_client_1.decorateServiceException(exception, body);
1965
1259
  };
1966
1260
  const deserializeAws_json1_0ConflictExceptionResponse = async (parsedOutput, context) => {
1967
1261
  const body = parsedOutput.body;
1968
1262
  const deserialized = deserializeAws_json1_0ConflictException(body, context);
1969
- const contents = {
1970
- name: "ConflictException",
1971
- $fault: "client",
1263
+ const exception = new models_0_1.ConflictException({
1972
1264
  $metadata: deserializeMetadata(parsedOutput),
1973
1265
  ...deserialized,
1974
- };
1975
- return contents;
1266
+ });
1267
+ return smithy_client_1.decorateServiceException(exception, body);
1976
1268
  };
1977
1269
  const deserializeAws_json1_0InternalServerExceptionResponse = async (parsedOutput, context) => {
1978
1270
  const body = parsedOutput.body;
1979
1271
  const deserialized = deserializeAws_json1_0InternalServerException(body, context);
1980
- const contents = {
1981
- name: "InternalServerException",
1982
- $fault: "server",
1272
+ const exception = new models_0_1.InternalServerException({
1983
1273
  $metadata: deserializeMetadata(parsedOutput),
1984
1274
  ...deserialized,
1985
- };
1986
- return contents;
1275
+ });
1276
+ return smithy_client_1.decorateServiceException(exception, body);
1987
1277
  };
1988
1278
  const deserializeAws_json1_0ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1989
1279
  const body = parsedOutput.body;
1990
1280
  const deserialized = deserializeAws_json1_0ResourceNotFoundException(body, context);
1991
- const contents = {
1992
- name: "ResourceNotFoundException",
1993
- $fault: "client",
1281
+ const exception = new models_0_1.ResourceNotFoundException({
1994
1282
  $metadata: deserializeMetadata(parsedOutput),
1995
1283
  ...deserialized,
1996
- };
1997
- return contents;
1284
+ });
1285
+ return smithy_client_1.decorateServiceException(exception, body);
1998
1286
  };
1999
1287
  const deserializeAws_json1_0ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2000
1288
  const body = parsedOutput.body;
2001
1289
  const deserialized = deserializeAws_json1_0ServiceQuotaExceededException(body, context);
2002
- const contents = {
2003
- name: "ServiceQuotaExceededException",
2004
- $fault: "client",
1290
+ const exception = new models_0_1.ServiceQuotaExceededException({
2005
1291
  $metadata: deserializeMetadata(parsedOutput),
2006
1292
  ...deserialized,
2007
- };
2008
- return contents;
1293
+ });
1294
+ return smithy_client_1.decorateServiceException(exception, body);
2009
1295
  };
2010
1296
  const deserializeAws_json1_0ThrottlingExceptionResponse = async (parsedOutput, context) => {
2011
1297
  const body = parsedOutput.body;
2012
1298
  const deserialized = deserializeAws_json1_0ThrottlingException(body, context);
2013
- const contents = {
2014
- name: "ThrottlingException",
2015
- $fault: "client",
1299
+ const exception = new models_0_1.ThrottlingException({
2016
1300
  $metadata: deserializeMetadata(parsedOutput),
2017
1301
  ...deserialized,
2018
- };
2019
- return contents;
1302
+ });
1303
+ return smithy_client_1.decorateServiceException(exception, body);
2020
1304
  };
2021
1305
  const deserializeAws_json1_0ValidationExceptionResponse = async (parsedOutput, context) => {
2022
1306
  const body = parsedOutput.body;
2023
1307
  const deserialized = deserializeAws_json1_0ValidationException(body, context);
2024
- const contents = {
2025
- name: "ValidationException",
2026
- $fault: "client",
1308
+ const exception = new models_0_1.ValidationException({
2027
1309
  $metadata: deserializeMetadata(parsedOutput),
2028
1310
  ...deserialized,
2029
- };
2030
- return contents;
1311
+ });
1312
+ return smithy_client_1.decorateServiceException(exception, body);
2031
1313
  };
2032
1314
  const serializeAws_json1_0CreateDomainRequest = (input, context) => {
2033
1315
  var _a;
@@ -2367,7 +1649,7 @@ const deserializeAws_json1_0Domain = (output, context) => {
2367
1649
  };
2368
1650
  };
2369
1651
  const deserializeAws_json1_0DomainSummaries = (output, context) => {
2370
- return (output || [])
1652
+ const retVal = (output || [])
2371
1653
  .filter((e) => e != null)
2372
1654
  .map((entry) => {
2373
1655
  if (entry === null) {
@@ -2375,6 +1657,7 @@ const deserializeAws_json1_0DomainSummaries = (output, context) => {
2375
1657
  }
2376
1658
  return deserializeAws_json1_0DomainSummary(entry, context);
2377
1659
  });
1660
+ return retVal;
2378
1661
  };
2379
1662
  const deserializeAws_json1_0DomainSummary = (output, context) => {
2380
1663
  return {
@@ -2434,7 +1717,7 @@ const deserializeAws_json1_0FraudDetectionConfiguration = (output, context) => {
2434
1717
  };
2435
1718
  };
2436
1719
  const deserializeAws_json1_0FraudDetectionReasons = (output, context) => {
2437
- return (output || [])
1720
+ const retVal = (output || [])
2438
1721
  .filter((e) => e != null)
2439
1722
  .map((entry) => {
2440
1723
  if (entry === null) {
@@ -2442,6 +1725,7 @@ const deserializeAws_json1_0FraudDetectionReasons = (output, context) => {
2442
1725
  }
2443
1726
  return smithy_client_1.expectString(entry);
2444
1727
  });
1728
+ return retVal;
2445
1729
  };
2446
1730
  const deserializeAws_json1_0FraudDetectionResult = (output, context) => {
2447
1731
  return {
@@ -2511,7 +1795,7 @@ const deserializeAws_json1_0FraudsterRegistrationJob = (output, context) => {
2511
1795
  };
2512
1796
  };
2513
1797
  const deserializeAws_json1_0FraudsterRegistrationJobSummaries = (output, context) => {
2514
- return (output || [])
1798
+ const retVal = (output || [])
2515
1799
  .filter((e) => e != null)
2516
1800
  .map((entry) => {
2517
1801
  if (entry === null) {
@@ -2519,6 +1803,7 @@ const deserializeAws_json1_0FraudsterRegistrationJobSummaries = (output, context
2519
1803
  }
2520
1804
  return deserializeAws_json1_0FraudsterRegistrationJobSummary(entry, context);
2521
1805
  });
1806
+ return retVal;
2522
1807
  };
2523
1808
  const deserializeAws_json1_0FraudsterRegistrationJobSummary = (output, context) => {
2524
1809
  return {
@@ -2680,7 +1965,7 @@ const deserializeAws_json1_0SpeakerEnrollmentJob = (output, context) => {
2680
1965
  };
2681
1966
  };
2682
1967
  const deserializeAws_json1_0SpeakerEnrollmentJobSummaries = (output, context) => {
2683
- return (output || [])
1968
+ const retVal = (output || [])
2684
1969
  .filter((e) => e != null)
2685
1970
  .map((entry) => {
2686
1971
  if (entry === null) {
@@ -2688,6 +1973,7 @@ const deserializeAws_json1_0SpeakerEnrollmentJobSummaries = (output, context) =>
2688
1973
  }
2689
1974
  return deserializeAws_json1_0SpeakerEnrollmentJobSummary(entry, context);
2690
1975
  });
1976
+ return retVal;
2691
1977
  };
2692
1978
  const deserializeAws_json1_0SpeakerEnrollmentJobSummary = (output, context) => {
2693
1979
  return {
@@ -2710,7 +1996,7 @@ const deserializeAws_json1_0SpeakerEnrollmentJobSummary = (output, context) => {
2710
1996
  };
2711
1997
  };
2712
1998
  const deserializeAws_json1_0SpeakerSummaries = (output, context) => {
2713
- return (output || [])
1999
+ const retVal = (output || [])
2714
2000
  .filter((e) => e != null)
2715
2001
  .map((entry) => {
2716
2002
  if (entry === null) {
@@ -2718,6 +2004,7 @@ const deserializeAws_json1_0SpeakerSummaries = (output, context) => {
2718
2004
  }
2719
2005
  return deserializeAws_json1_0SpeakerSummary(entry, context);
2720
2006
  });
2007
+ return retVal;
2721
2008
  };
2722
2009
  const deserializeAws_json1_0SpeakerSummary = (output, context) => {
2723
2010
  return {
@@ -2754,7 +2041,7 @@ const deserializeAws_json1_0Tag = (output, context) => {
2754
2041
  };
2755
2042
  };
2756
2043
  const deserializeAws_json1_0TagList = (output, context) => {
2757
- return (output || [])
2044
+ const retVal = (output || [])
2758
2045
  .filter((e) => e != null)
2759
2046
  .map((entry) => {
2760
2047
  if (entry === null) {
@@ -2762,6 +2049,7 @@ const deserializeAws_json1_0TagList = (output, context) => {
2762
2049
  }
2763
2050
  return deserializeAws_json1_0Tag(entry, context);
2764
2051
  });
2052
+ return retVal;
2765
2053
  };
2766
2054
  const deserializeAws_json1_0TagResourceResponse = (output, context) => {
2767
2055
  return {};