@aws-sdk/client-iot-data-plane 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_restJson1UpdateThingShadowCommand = exports.deserializeAws_restJson1PublishCommand = exports.deserializeAws_restJson1ListRetainedMessagesCommand = exports.deserializeAws_restJson1ListNamedShadowsForThingCommand = exports.deserializeAws_restJson1GetThingShadowCommand = exports.deserializeAws_restJson1GetRetainedMessageCommand = exports.deserializeAws_restJson1DeleteThingShadowCommand = exports.serializeAws_restJson1UpdateThingShadowCommand = exports.serializeAws_restJson1PublishCommand = exports.serializeAws_restJson1ListRetainedMessagesCommand = exports.serializeAws_restJson1ListNamedShadowsForThingCommand = exports.serializeAws_restJson1GetThingShadowCommand = exports.serializeAws_restJson1GetRetainedMessageCommand = exports.serializeAws_restJson1DeleteThingShadowCommand = 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 IoTDataPlaneServiceException_1 = require("../models/IoTDataPlaneServiceException");
7
+ const models_0_1 = require("../models/models_0");
6
8
  const serializeAws_restJson1DeleteThingShadowCommand = async (input, context) => {
7
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
10
  const headers = {};
@@ -237,83 +239,37 @@ const deserializeAws_restJson1DeleteThingShadowCommandError = async (output, con
237
239
  switch (errorCode) {
238
240
  case "InternalFailureException":
239
241
  case "com.amazonaws.iotdataplane#InternalFailureException":
240
- response = {
241
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
242
- name: errorCode,
243
- $metadata: deserializeMetadata(output),
244
- };
245
- break;
242
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
246
243
  case "InvalidRequestException":
247
244
  case "com.amazonaws.iotdataplane#InvalidRequestException":
248
- response = {
249
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
250
- name: errorCode,
251
- $metadata: deserializeMetadata(output),
252
- };
253
- break;
245
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
254
246
  case "MethodNotAllowedException":
255
247
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
256
- response = {
257
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
258
- name: errorCode,
259
- $metadata: deserializeMetadata(output),
260
- };
261
- break;
248
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
262
249
  case "ResourceNotFoundException":
263
250
  case "com.amazonaws.iotdataplane#ResourceNotFoundException":
264
- response = {
265
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
266
- name: errorCode,
267
- $metadata: deserializeMetadata(output),
268
- };
269
- break;
251
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
270
252
  case "ServiceUnavailableException":
271
253
  case "com.amazonaws.iotdataplane#ServiceUnavailableException":
272
- response = {
273
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
274
- name: errorCode,
275
- $metadata: deserializeMetadata(output),
276
- };
277
- break;
254
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
278
255
  case "ThrottlingException":
279
256
  case "com.amazonaws.iotdataplane#ThrottlingException":
280
- response = {
281
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
282
- name: errorCode,
283
- $metadata: deserializeMetadata(output),
284
- };
285
- break;
257
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
286
258
  case "UnauthorizedException":
287
259
  case "com.amazonaws.iotdataplane#UnauthorizedException":
288
- response = {
289
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
290
- name: errorCode,
291
- $metadata: deserializeMetadata(output),
292
- };
293
- break;
260
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
294
261
  case "UnsupportedDocumentEncodingException":
295
262
  case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
296
- response = {
297
- ...(await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context)),
298
- name: errorCode,
299
- $metadata: deserializeMetadata(output),
300
- };
301
- break;
263
+ throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
302
264
  default:
303
265
  const parsedBody = parsedOutput.body;
304
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
305
- response = {
306
- ...parsedBody,
307
- name: `${errorCode}`,
308
- message: parsedBody.message || parsedBody.Message || errorCode,
266
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
267
+ name: parsedBody.code || parsedBody.Code || errorCode,
309
268
  $fault: "client",
310
269
  $metadata: deserializeMetadata(output),
311
- };
270
+ });
271
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
312
272
  }
313
- const message = response.message || response.Message || errorCode;
314
- response.message = message;
315
- delete response.Message;
316
- return Promise.reject(Object.assign(new Error(message), response));
317
273
  };
318
274
  const deserializeAws_restJson1GetRetainedMessageCommand = async (output, context) => {
319
275
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -353,75 +309,34 @@ const deserializeAws_restJson1GetRetainedMessageCommandError = async (output, co
353
309
  switch (errorCode) {
354
310
  case "InternalFailureException":
355
311
  case "com.amazonaws.iotdataplane#InternalFailureException":
356
- response = {
357
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
358
- name: errorCode,
359
- $metadata: deserializeMetadata(output),
360
- };
361
- break;
312
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
362
313
  case "InvalidRequestException":
363
314
  case "com.amazonaws.iotdataplane#InvalidRequestException":
364
- response = {
365
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
366
- name: errorCode,
367
- $metadata: deserializeMetadata(output),
368
- };
369
- break;
315
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
370
316
  case "MethodNotAllowedException":
371
317
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
372
- response = {
373
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
374
- name: errorCode,
375
- $metadata: deserializeMetadata(output),
376
- };
377
- break;
318
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
378
319
  case "ResourceNotFoundException":
379
320
  case "com.amazonaws.iotdataplane#ResourceNotFoundException":
380
- response = {
381
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
382
- name: errorCode,
383
- $metadata: deserializeMetadata(output),
384
- };
385
- break;
321
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
386
322
  case "ServiceUnavailableException":
387
323
  case "com.amazonaws.iotdataplane#ServiceUnavailableException":
388
- response = {
389
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
390
- name: errorCode,
391
- $metadata: deserializeMetadata(output),
392
- };
393
- break;
324
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
394
325
  case "ThrottlingException":
395
326
  case "com.amazonaws.iotdataplane#ThrottlingException":
396
- response = {
397
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
398
- name: errorCode,
399
- $metadata: deserializeMetadata(output),
400
- };
401
- break;
327
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
402
328
  case "UnauthorizedException":
403
329
  case "com.amazonaws.iotdataplane#UnauthorizedException":
404
- response = {
405
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
406
- name: errorCode,
407
- $metadata: deserializeMetadata(output),
408
- };
409
- break;
330
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
410
331
  default:
411
332
  const parsedBody = parsedOutput.body;
412
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
413
- response = {
414
- ...parsedBody,
415
- name: `${errorCode}`,
416
- message: parsedBody.message || parsedBody.Message || errorCode,
333
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
334
+ name: parsedBody.code || parsedBody.Code || errorCode,
417
335
  $fault: "client",
418
336
  $metadata: deserializeMetadata(output),
419
- };
337
+ });
338
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
420
339
  }
421
- const message = response.message || response.Message || errorCode;
422
- response.message = message;
423
- delete response.Message;
424
- return Promise.reject(Object.assign(new Error(message), response));
425
340
  };
426
341
  const deserializeAws_restJson1GetThingShadowCommand = async (output, context) => {
427
342
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -447,83 +362,37 @@ const deserializeAws_restJson1GetThingShadowCommandError = async (output, contex
447
362
  switch (errorCode) {
448
363
  case "InternalFailureException":
449
364
  case "com.amazonaws.iotdataplane#InternalFailureException":
450
- response = {
451
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
452
- name: errorCode,
453
- $metadata: deserializeMetadata(output),
454
- };
455
- break;
365
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
456
366
  case "InvalidRequestException":
457
367
  case "com.amazonaws.iotdataplane#InvalidRequestException":
458
- response = {
459
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
460
- name: errorCode,
461
- $metadata: deserializeMetadata(output),
462
- };
463
- break;
368
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
464
369
  case "MethodNotAllowedException":
465
370
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
466
- response = {
467
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
468
- name: errorCode,
469
- $metadata: deserializeMetadata(output),
470
- };
471
- break;
371
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
472
372
  case "ResourceNotFoundException":
473
373
  case "com.amazonaws.iotdataplane#ResourceNotFoundException":
474
- response = {
475
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
476
- name: errorCode,
477
- $metadata: deserializeMetadata(output),
478
- };
479
- break;
374
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
480
375
  case "ServiceUnavailableException":
481
376
  case "com.amazonaws.iotdataplane#ServiceUnavailableException":
482
- response = {
483
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
484
- name: errorCode,
485
- $metadata: deserializeMetadata(output),
486
- };
487
- break;
377
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
488
378
  case "ThrottlingException":
489
379
  case "com.amazonaws.iotdataplane#ThrottlingException":
490
- response = {
491
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
492
- name: errorCode,
493
- $metadata: deserializeMetadata(output),
494
- };
495
- break;
380
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
496
381
  case "UnauthorizedException":
497
382
  case "com.amazonaws.iotdataplane#UnauthorizedException":
498
- response = {
499
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
500
- name: errorCode,
501
- $metadata: deserializeMetadata(output),
502
- };
503
- break;
383
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
504
384
  case "UnsupportedDocumentEncodingException":
505
385
  case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
506
- response = {
507
- ...(await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context)),
508
- name: errorCode,
509
- $metadata: deserializeMetadata(output),
510
- };
511
- break;
386
+ throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
512
387
  default:
513
388
  const parsedBody = parsedOutput.body;
514
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
515
- response = {
516
- ...parsedBody,
517
- name: `${errorCode}`,
518
- message: parsedBody.message || parsedBody.Message || errorCode,
389
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
390
+ name: parsedBody.code || parsedBody.Code || errorCode,
519
391
  $fault: "client",
520
392
  $metadata: deserializeMetadata(output),
521
- };
393
+ });
394
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
522
395
  }
523
- const message = response.message || response.Message || errorCode;
524
- response.message = message;
525
- delete response.Message;
526
- return Promise.reject(Object.assign(new Error(message), response));
527
396
  };
528
397
  const deserializeAws_restJson1ListNamedShadowsForThingCommand = async (output, context) => {
529
398
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -559,75 +428,34 @@ const deserializeAws_restJson1ListNamedShadowsForThingCommandError = async (outp
559
428
  switch (errorCode) {
560
429
  case "InternalFailureException":
561
430
  case "com.amazonaws.iotdataplane#InternalFailureException":
562
- response = {
563
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
564
- name: errorCode,
565
- $metadata: deserializeMetadata(output),
566
- };
567
- break;
431
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
568
432
  case "InvalidRequestException":
569
433
  case "com.amazonaws.iotdataplane#InvalidRequestException":
570
- response = {
571
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
572
- name: errorCode,
573
- $metadata: deserializeMetadata(output),
574
- };
575
- break;
434
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
576
435
  case "MethodNotAllowedException":
577
436
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
578
- response = {
579
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
580
- name: errorCode,
581
- $metadata: deserializeMetadata(output),
582
- };
583
- break;
437
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
584
438
  case "ResourceNotFoundException":
585
439
  case "com.amazonaws.iotdataplane#ResourceNotFoundException":
586
- response = {
587
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
588
- name: errorCode,
589
- $metadata: deserializeMetadata(output),
590
- };
591
- break;
440
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
592
441
  case "ServiceUnavailableException":
593
442
  case "com.amazonaws.iotdataplane#ServiceUnavailableException":
594
- response = {
595
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
596
- name: errorCode,
597
- $metadata: deserializeMetadata(output),
598
- };
599
- break;
443
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
600
444
  case "ThrottlingException":
601
445
  case "com.amazonaws.iotdataplane#ThrottlingException":
602
- response = {
603
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
604
- name: errorCode,
605
- $metadata: deserializeMetadata(output),
606
- };
607
- break;
446
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
608
447
  case "UnauthorizedException":
609
448
  case "com.amazonaws.iotdataplane#UnauthorizedException":
610
- response = {
611
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
612
- name: errorCode,
613
- $metadata: deserializeMetadata(output),
614
- };
615
- break;
449
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
616
450
  default:
617
451
  const parsedBody = parsedOutput.body;
618
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
619
- response = {
620
- ...parsedBody,
621
- name: `${errorCode}`,
622
- message: parsedBody.message || parsedBody.Message || errorCode,
452
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
453
+ name: parsedBody.code || parsedBody.Code || errorCode,
623
454
  $fault: "client",
624
455
  $metadata: deserializeMetadata(output),
625
- };
456
+ });
457
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
626
458
  }
627
- const message = response.message || response.Message || errorCode;
628
- response.message = message;
629
- delete response.Message;
630
- return Promise.reject(Object.assign(new Error(message), response));
631
459
  };
632
460
  const deserializeAws_restJson1ListRetainedMessagesCommand = async (output, context) => {
633
461
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -659,67 +487,31 @@ const deserializeAws_restJson1ListRetainedMessagesCommandError = async (output,
659
487
  switch (errorCode) {
660
488
  case "InternalFailureException":
661
489
  case "com.amazonaws.iotdataplane#InternalFailureException":
662
- response = {
663
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
664
- name: errorCode,
665
- $metadata: deserializeMetadata(output),
666
- };
667
- break;
490
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
668
491
  case "InvalidRequestException":
669
492
  case "com.amazonaws.iotdataplane#InvalidRequestException":
670
- response = {
671
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
672
- name: errorCode,
673
- $metadata: deserializeMetadata(output),
674
- };
675
- break;
493
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
676
494
  case "MethodNotAllowedException":
677
495
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
678
- response = {
679
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
680
- name: errorCode,
681
- $metadata: deserializeMetadata(output),
682
- };
683
- break;
496
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
684
497
  case "ServiceUnavailableException":
685
498
  case "com.amazonaws.iotdataplane#ServiceUnavailableException":
686
- response = {
687
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
688
- name: errorCode,
689
- $metadata: deserializeMetadata(output),
690
- };
691
- break;
499
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
692
500
  case "ThrottlingException":
693
501
  case "com.amazonaws.iotdataplane#ThrottlingException":
694
- response = {
695
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
696
- name: errorCode,
697
- $metadata: deserializeMetadata(output),
698
- };
699
- break;
502
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
700
503
  case "UnauthorizedException":
701
504
  case "com.amazonaws.iotdataplane#UnauthorizedException":
702
- response = {
703
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
704
- name: errorCode,
705
- $metadata: deserializeMetadata(output),
706
- };
707
- break;
505
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
708
506
  default:
709
507
  const parsedBody = parsedOutput.body;
710
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
711
- response = {
712
- ...parsedBody,
713
- name: `${errorCode}`,
714
- message: parsedBody.message || parsedBody.Message || errorCode,
508
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
509
+ name: parsedBody.code || parsedBody.Code || errorCode,
715
510
  $fault: "client",
716
511
  $metadata: deserializeMetadata(output),
717
- };
512
+ });
513
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
718
514
  }
719
- const message = response.message || response.Message || errorCode;
720
- response.message = message;
721
- delete response.Message;
722
- return Promise.reject(Object.assign(new Error(message), response));
723
515
  };
724
516
  const deserializeAws_restJson1PublishCommand = async (output, context) => {
725
517
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -743,51 +535,25 @@ const deserializeAws_restJson1PublishCommandError = async (output, context) => {
743
535
  switch (errorCode) {
744
536
  case "InternalFailureException":
745
537
  case "com.amazonaws.iotdataplane#InternalFailureException":
746
- response = {
747
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
748
- name: errorCode,
749
- $metadata: deserializeMetadata(output),
750
- };
751
- break;
538
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
752
539
  case "InvalidRequestException":
753
540
  case "com.amazonaws.iotdataplane#InvalidRequestException":
754
- response = {
755
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
756
- name: errorCode,
757
- $metadata: deserializeMetadata(output),
758
- };
759
- break;
541
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
760
542
  case "MethodNotAllowedException":
761
543
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
762
- response = {
763
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
764
- name: errorCode,
765
- $metadata: deserializeMetadata(output),
766
- };
767
- break;
544
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
768
545
  case "UnauthorizedException":
769
546
  case "com.amazonaws.iotdataplane#UnauthorizedException":
770
- response = {
771
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
772
- name: errorCode,
773
- $metadata: deserializeMetadata(output),
774
- };
775
- break;
547
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
776
548
  default:
777
549
  const parsedBody = parsedOutput.body;
778
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
779
- response = {
780
- ...parsedBody,
781
- name: `${errorCode}`,
782
- message: parsedBody.message || parsedBody.Message || errorCode,
550
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
551
+ name: parsedBody.code || parsedBody.Code || errorCode,
783
552
  $fault: "client",
784
553
  $metadata: deserializeMetadata(output),
785
- };
554
+ });
555
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
786
556
  }
787
- const message = response.message || response.Message || errorCode;
788
- response.message = message;
789
- delete response.Message;
790
- return Promise.reject(Object.assign(new Error(message), response));
791
557
  };
792
558
  const deserializeAws_restJson1UpdateThingShadowCommand = async (output, context) => {
793
559
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -813,224 +579,163 @@ const deserializeAws_restJson1UpdateThingShadowCommandError = async (output, con
813
579
  switch (errorCode) {
814
580
  case "ConflictException":
815
581
  case "com.amazonaws.iotdataplane#ConflictException":
816
- response = {
817
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
818
- name: errorCode,
819
- $metadata: deserializeMetadata(output),
820
- };
821
- break;
582
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
822
583
  case "InternalFailureException":
823
584
  case "com.amazonaws.iotdataplane#InternalFailureException":
824
- response = {
825
- ...(await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)),
826
- name: errorCode,
827
- $metadata: deserializeMetadata(output),
828
- };
829
- break;
585
+ throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
830
586
  case "InvalidRequestException":
831
587
  case "com.amazonaws.iotdataplane#InvalidRequestException":
832
- response = {
833
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
834
- name: errorCode,
835
- $metadata: deserializeMetadata(output),
836
- };
837
- break;
588
+ throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
838
589
  case "MethodNotAllowedException":
839
590
  case "com.amazonaws.iotdataplane#MethodNotAllowedException":
840
- response = {
841
- ...(await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)),
842
- name: errorCode,
843
- $metadata: deserializeMetadata(output),
844
- };
845
- break;
591
+ throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
846
592
  case "RequestEntityTooLargeException":
847
593
  case "com.amazonaws.iotdataplane#RequestEntityTooLargeException":
848
- response = {
849
- ...(await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context)),
850
- name: errorCode,
851
- $metadata: deserializeMetadata(output),
852
- };
853
- break;
594
+ throw await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context);
854
595
  case "ServiceUnavailableException":
855
596
  case "com.amazonaws.iotdataplane#ServiceUnavailableException":
856
- response = {
857
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
858
- name: errorCode,
859
- $metadata: deserializeMetadata(output),
860
- };
861
- break;
597
+ throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
862
598
  case "ThrottlingException":
863
599
  case "com.amazonaws.iotdataplane#ThrottlingException":
864
- response = {
865
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
866
- name: errorCode,
867
- $metadata: deserializeMetadata(output),
868
- };
869
- break;
600
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
870
601
  case "UnauthorizedException":
871
602
  case "com.amazonaws.iotdataplane#UnauthorizedException":
872
- response = {
873
- ...(await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)),
874
- name: errorCode,
875
- $metadata: deserializeMetadata(output),
876
- };
877
- break;
603
+ throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
878
604
  case "UnsupportedDocumentEncodingException":
879
605
  case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
880
- response = {
881
- ...(await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context)),
882
- name: errorCode,
883
- $metadata: deserializeMetadata(output),
884
- };
885
- break;
606
+ throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
886
607
  default:
887
608
  const parsedBody = parsedOutput.body;
888
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
889
- response = {
890
- ...parsedBody,
891
- name: `${errorCode}`,
892
- message: parsedBody.message || parsedBody.Message || errorCode,
609
+ response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
610
+ name: parsedBody.code || parsedBody.Code || errorCode,
893
611
  $fault: "client",
894
612
  $metadata: deserializeMetadata(output),
895
- };
613
+ });
614
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
896
615
  }
897
- const message = response.message || response.Message || errorCode;
898
- response.message = message;
899
- delete response.Message;
900
- return Promise.reject(Object.assign(new Error(message), response));
901
616
  };
902
617
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
903
- const contents = {
904
- name: "ConflictException",
905
- $fault: "client",
906
- $metadata: deserializeMetadata(parsedOutput),
907
- message: undefined,
908
- };
618
+ const contents = {};
909
619
  const data = parsedOutput.body;
910
620
  if (data.message !== undefined && data.message !== null) {
911
621
  contents.message = smithy_client_1.expectString(data.message);
912
622
  }
913
- return contents;
623
+ const exception = new models_0_1.ConflictException({
624
+ $metadata: deserializeMetadata(parsedOutput),
625
+ ...contents,
626
+ });
627
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
914
628
  };
915
629
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
916
- const contents = {
917
- name: "InternalFailureException",
918
- $fault: "server",
919
- $metadata: deserializeMetadata(parsedOutput),
920
- message: undefined,
921
- };
630
+ const contents = {};
922
631
  const data = parsedOutput.body;
923
632
  if (data.message !== undefined && data.message !== null) {
924
633
  contents.message = smithy_client_1.expectString(data.message);
925
634
  }
926
- return contents;
635
+ const exception = new models_0_1.InternalFailureException({
636
+ $metadata: deserializeMetadata(parsedOutput),
637
+ ...contents,
638
+ });
639
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
927
640
  };
928
641
  const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
929
- const contents = {
930
- name: "InvalidRequestException",
931
- $fault: "client",
932
- $metadata: deserializeMetadata(parsedOutput),
933
- message: undefined,
934
- };
642
+ const contents = {};
935
643
  const data = parsedOutput.body;
936
644
  if (data.message !== undefined && data.message !== null) {
937
645
  contents.message = smithy_client_1.expectString(data.message);
938
646
  }
939
- return contents;
647
+ const exception = new models_0_1.InvalidRequestException({
648
+ $metadata: deserializeMetadata(parsedOutput),
649
+ ...contents,
650
+ });
651
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
940
652
  };
941
653
  const deserializeAws_restJson1MethodNotAllowedExceptionResponse = async (parsedOutput, context) => {
942
- const contents = {
943
- name: "MethodNotAllowedException",
944
- $fault: "client",
945
- $metadata: deserializeMetadata(parsedOutput),
946
- message: undefined,
947
- };
654
+ const contents = {};
948
655
  const data = parsedOutput.body;
949
656
  if (data.message !== undefined && data.message !== null) {
950
657
  contents.message = smithy_client_1.expectString(data.message);
951
658
  }
952
- return contents;
659
+ const exception = new models_0_1.MethodNotAllowedException({
660
+ $metadata: deserializeMetadata(parsedOutput),
661
+ ...contents,
662
+ });
663
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
953
664
  };
954
665
  const deserializeAws_restJson1RequestEntityTooLargeExceptionResponse = async (parsedOutput, context) => {
955
- const contents = {
956
- name: "RequestEntityTooLargeException",
957
- $fault: "client",
958
- $metadata: deserializeMetadata(parsedOutput),
959
- message: undefined,
960
- };
666
+ const contents = {};
961
667
  const data = parsedOutput.body;
962
668
  if (data.message !== undefined && data.message !== null) {
963
669
  contents.message = smithy_client_1.expectString(data.message);
964
670
  }
965
- return contents;
671
+ const exception = new models_0_1.RequestEntityTooLargeException({
672
+ $metadata: deserializeMetadata(parsedOutput),
673
+ ...contents,
674
+ });
675
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
966
676
  };
967
677
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
968
- const contents = {
969
- name: "ResourceNotFoundException",
970
- $fault: "client",
971
- $metadata: deserializeMetadata(parsedOutput),
972
- message: undefined,
973
- };
678
+ const contents = {};
974
679
  const data = parsedOutput.body;
975
680
  if (data.message !== undefined && data.message !== null) {
976
681
  contents.message = smithy_client_1.expectString(data.message);
977
682
  }
978
- return contents;
683
+ const exception = new models_0_1.ResourceNotFoundException({
684
+ $metadata: deserializeMetadata(parsedOutput),
685
+ ...contents,
686
+ });
687
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
979
688
  };
980
689
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
981
- const contents = {
982
- name: "ServiceUnavailableException",
983
- $fault: "server",
984
- $metadata: deserializeMetadata(parsedOutput),
985
- message: undefined,
986
- };
690
+ const contents = {};
987
691
  const data = parsedOutput.body;
988
692
  if (data.message !== undefined && data.message !== null) {
989
693
  contents.message = smithy_client_1.expectString(data.message);
990
694
  }
991
- return contents;
695
+ const exception = new models_0_1.ServiceUnavailableException({
696
+ $metadata: deserializeMetadata(parsedOutput),
697
+ ...contents,
698
+ });
699
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
992
700
  };
993
701
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
994
- const contents = {
995
- name: "ThrottlingException",
996
- $fault: "client",
997
- $metadata: deserializeMetadata(parsedOutput),
998
- message: undefined,
999
- };
702
+ const contents = {};
1000
703
  const data = parsedOutput.body;
1001
704
  if (data.message !== undefined && data.message !== null) {
1002
705
  contents.message = smithy_client_1.expectString(data.message);
1003
706
  }
1004
- return contents;
707
+ const exception = new models_0_1.ThrottlingException({
708
+ $metadata: deserializeMetadata(parsedOutput),
709
+ ...contents,
710
+ });
711
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1005
712
  };
1006
713
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
1007
- const contents = {
1008
- name: "UnauthorizedException",
1009
- $fault: "client",
1010
- $metadata: deserializeMetadata(parsedOutput),
1011
- message: undefined,
1012
- };
714
+ const contents = {};
1013
715
  const data = parsedOutput.body;
1014
716
  if (data.message !== undefined && data.message !== null) {
1015
717
  contents.message = smithy_client_1.expectString(data.message);
1016
718
  }
1017
- return contents;
719
+ const exception = new models_0_1.UnauthorizedException({
720
+ $metadata: deserializeMetadata(parsedOutput),
721
+ ...contents,
722
+ });
723
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1018
724
  };
1019
725
  const deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse = async (parsedOutput, context) => {
1020
- const contents = {
1021
- name: "UnsupportedDocumentEncodingException",
1022
- $fault: "client",
1023
- $metadata: deserializeMetadata(parsedOutput),
1024
- message: undefined,
1025
- };
726
+ const contents = {};
1026
727
  const data = parsedOutput.body;
1027
728
  if (data.message !== undefined && data.message !== null) {
1028
729
  contents.message = smithy_client_1.expectString(data.message);
1029
730
  }
1030
- return contents;
731
+ const exception = new models_0_1.UnsupportedDocumentEncodingException({
732
+ $metadata: deserializeMetadata(parsedOutput),
733
+ ...contents,
734
+ });
735
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
1031
736
  };
1032
737
  const deserializeAws_restJson1NamedShadowList = (output, context) => {
1033
- return (output || [])
738
+ const retVal = (output || [])
1034
739
  .filter((e) => e != null)
1035
740
  .map((entry) => {
1036
741
  if (entry === null) {
@@ -1038,9 +743,10 @@ const deserializeAws_restJson1NamedShadowList = (output, context) => {
1038
743
  }
1039
744
  return smithy_client_1.expectString(entry);
1040
745
  });
746
+ return retVal;
1041
747
  };
1042
748
  const deserializeAws_restJson1RetainedMessageList = (output, context) => {
1043
- return (output || [])
749
+ const retVal = (output || [])
1044
750
  .filter((e) => e != null)
1045
751
  .map((entry) => {
1046
752
  if (entry === null) {
@@ -1048,6 +754,7 @@ const deserializeAws_restJson1RetainedMessageList = (output, context) => {
1048
754
  }
1049
755
  return deserializeAws_restJson1RetainedMessageSummary(entry, context);
1050
756
  });
757
+ return retVal;
1051
758
  };
1052
759
  const deserializeAws_restJson1RetainedMessageSummary = (output, context) => {
1053
760
  return {