@aws-sdk/client-healthlake 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.
@@ -4,6 +4,7 @@ exports.deserializeAws_json1_0UntagResourceCommand = exports.deserializeAws_json
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 HealthLakeServiceException_1 = require("../models/HealthLakeServiceException");
7
8
  const models_0_1 = require("../models/models_0");
8
9
  const serializeAws_json1_0CreateFHIRDatastoreCommand = async (input, context) => {
9
10
  const headers = {
@@ -160,51 +161,25 @@ const deserializeAws_json1_0CreateFHIRDatastoreCommandError = async (output, con
160
161
  switch (errorCode) {
161
162
  case "AccessDeniedException":
162
163
  case "com.amazonaws.healthlake#AccessDeniedException":
163
- response = {
164
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
165
- name: errorCode,
166
- $metadata: deserializeMetadata(output),
167
- };
168
- break;
164
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
169
165
  case "InternalServerException":
170
166
  case "com.amazonaws.healthlake#InternalServerException":
171
- response = {
172
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
173
- name: errorCode,
174
- $metadata: deserializeMetadata(output),
175
- };
176
- break;
167
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
177
168
  case "ThrottlingException":
178
169
  case "com.amazonaws.healthlake#ThrottlingException":
179
- response = {
180
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
181
- name: errorCode,
182
- $metadata: deserializeMetadata(output),
183
- };
184
- break;
170
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
185
171
  case "ValidationException":
186
172
  case "com.amazonaws.healthlake#ValidationException":
187
- response = {
188
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
189
- name: errorCode,
190
- $metadata: deserializeMetadata(output),
191
- };
192
- break;
173
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
193
174
  default:
194
175
  const parsedBody = parsedOutput.body;
195
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
196
- response = {
197
- ...parsedBody,
198
- name: `${errorCode}`,
199
- message: parsedBody.message || parsedBody.Message || errorCode,
176
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
177
+ name: parsedBody.code || parsedBody.Code || errorCode,
200
178
  $fault: "client",
201
179
  $metadata: deserializeMetadata(output),
202
- };
180
+ });
181
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
203
182
  }
204
- const message = response.message || response.Message || errorCode;
205
- response.message = message;
206
- delete response.Message;
207
- return Promise.reject(Object.assign(new Error(message), response));
208
183
  };
209
184
  const deserializeAws_json1_0DeleteFHIRDatastoreCommand = async (output, context) => {
210
185
  if (output.statusCode >= 300) {
@@ -231,67 +206,31 @@ const deserializeAws_json1_0DeleteFHIRDatastoreCommandError = async (output, con
231
206
  switch (errorCode) {
232
207
  case "AccessDeniedException":
233
208
  case "com.amazonaws.healthlake#AccessDeniedException":
234
- response = {
235
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
236
- name: errorCode,
237
- $metadata: deserializeMetadata(output),
238
- };
239
- break;
209
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
240
210
  case "ConflictException":
241
211
  case "com.amazonaws.healthlake#ConflictException":
242
- response = {
243
- ...(await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context)),
244
- name: errorCode,
245
- $metadata: deserializeMetadata(output),
246
- };
247
- break;
212
+ throw await deserializeAws_json1_0ConflictExceptionResponse(parsedOutput, context);
248
213
  case "InternalServerException":
249
214
  case "com.amazonaws.healthlake#InternalServerException":
250
- response = {
251
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
252
- name: errorCode,
253
- $metadata: deserializeMetadata(output),
254
- };
255
- break;
215
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
256
216
  case "ResourceNotFoundException":
257
217
  case "com.amazonaws.healthlake#ResourceNotFoundException":
258
- response = {
259
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
260
- name: errorCode,
261
- $metadata: deserializeMetadata(output),
262
- };
263
- break;
218
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
264
219
  case "ThrottlingException":
265
220
  case "com.amazonaws.healthlake#ThrottlingException":
266
- response = {
267
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
268
- name: errorCode,
269
- $metadata: deserializeMetadata(output),
270
- };
271
- break;
221
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
272
222
  case "ValidationException":
273
223
  case "com.amazonaws.healthlake#ValidationException":
274
- response = {
275
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
276
- name: errorCode,
277
- $metadata: deserializeMetadata(output),
278
- };
279
- break;
224
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
280
225
  default:
281
226
  const parsedBody = parsedOutput.body;
282
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
283
- response = {
284
- ...parsedBody,
285
- name: `${errorCode}`,
286
- message: parsedBody.message || parsedBody.Message || errorCode,
227
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
228
+ name: parsedBody.code || parsedBody.Code || errorCode,
287
229
  $fault: "client",
288
230
  $metadata: deserializeMetadata(output),
289
- };
231
+ });
232
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
290
233
  }
291
- const message = response.message || response.Message || errorCode;
292
- response.message = message;
293
- delete response.Message;
294
- return Promise.reject(Object.assign(new Error(message), response));
295
234
  };
296
235
  const deserializeAws_json1_0DescribeFHIRDatastoreCommand = async (output, context) => {
297
236
  if (output.statusCode >= 300) {
@@ -318,51 +257,25 @@ const deserializeAws_json1_0DescribeFHIRDatastoreCommandError = async (output, c
318
257
  switch (errorCode) {
319
258
  case "InternalServerException":
320
259
  case "com.amazonaws.healthlake#InternalServerException":
321
- response = {
322
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
323
- name: errorCode,
324
- $metadata: deserializeMetadata(output),
325
- };
326
- break;
260
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
327
261
  case "ResourceNotFoundException":
328
262
  case "com.amazonaws.healthlake#ResourceNotFoundException":
329
- response = {
330
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
331
- name: errorCode,
332
- $metadata: deserializeMetadata(output),
333
- };
334
- break;
263
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
335
264
  case "ThrottlingException":
336
265
  case "com.amazonaws.healthlake#ThrottlingException":
337
- response = {
338
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
339
- name: errorCode,
340
- $metadata: deserializeMetadata(output),
341
- };
342
- break;
266
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
343
267
  case "ValidationException":
344
268
  case "com.amazonaws.healthlake#ValidationException":
345
- response = {
346
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
347
- name: errorCode,
348
- $metadata: deserializeMetadata(output),
349
- };
350
- break;
269
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
351
270
  default:
352
271
  const parsedBody = parsedOutput.body;
353
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
354
- response = {
355
- ...parsedBody,
356
- name: `${errorCode}`,
357
- message: parsedBody.message || parsedBody.Message || errorCode,
272
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
273
+ name: parsedBody.code || parsedBody.Code || errorCode,
358
274
  $fault: "client",
359
275
  $metadata: deserializeMetadata(output),
360
- };
276
+ });
277
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
361
278
  }
362
- const message = response.message || response.Message || errorCode;
363
- response.message = message;
364
- delete response.Message;
365
- return Promise.reject(Object.assign(new Error(message), response));
366
279
  };
367
280
  const deserializeAws_json1_0DescribeFHIRExportJobCommand = async (output, context) => {
368
281
  if (output.statusCode >= 300) {
@@ -389,51 +302,25 @@ const deserializeAws_json1_0DescribeFHIRExportJobCommandError = async (output, c
389
302
  switch (errorCode) {
390
303
  case "InternalServerException":
391
304
  case "com.amazonaws.healthlake#InternalServerException":
392
- response = {
393
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
394
- name: errorCode,
395
- $metadata: deserializeMetadata(output),
396
- };
397
- break;
305
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
398
306
  case "ResourceNotFoundException":
399
307
  case "com.amazonaws.healthlake#ResourceNotFoundException":
400
- response = {
401
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
402
- name: errorCode,
403
- $metadata: deserializeMetadata(output),
404
- };
405
- break;
308
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
406
309
  case "ThrottlingException":
407
310
  case "com.amazonaws.healthlake#ThrottlingException":
408
- response = {
409
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
410
- name: errorCode,
411
- $metadata: deserializeMetadata(output),
412
- };
413
- break;
311
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
414
312
  case "ValidationException":
415
313
  case "com.amazonaws.healthlake#ValidationException":
416
- response = {
417
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
418
- name: errorCode,
419
- $metadata: deserializeMetadata(output),
420
- };
421
- break;
314
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
422
315
  default:
423
316
  const parsedBody = parsedOutput.body;
424
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
425
- response = {
426
- ...parsedBody,
427
- name: `${errorCode}`,
428
- message: parsedBody.message || parsedBody.Message || errorCode,
317
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
318
+ name: parsedBody.code || parsedBody.Code || errorCode,
429
319
  $fault: "client",
430
320
  $metadata: deserializeMetadata(output),
431
- };
321
+ });
322
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
432
323
  }
433
- const message = response.message || response.Message || errorCode;
434
- response.message = message;
435
- delete response.Message;
436
- return Promise.reject(Object.assign(new Error(message), response));
437
324
  };
438
325
  const deserializeAws_json1_0DescribeFHIRImportJobCommand = async (output, context) => {
439
326
  if (output.statusCode >= 300) {
@@ -460,51 +347,25 @@ const deserializeAws_json1_0DescribeFHIRImportJobCommandError = async (output, c
460
347
  switch (errorCode) {
461
348
  case "InternalServerException":
462
349
  case "com.amazonaws.healthlake#InternalServerException":
463
- response = {
464
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
465
- name: errorCode,
466
- $metadata: deserializeMetadata(output),
467
- };
468
- break;
350
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
469
351
  case "ResourceNotFoundException":
470
352
  case "com.amazonaws.healthlake#ResourceNotFoundException":
471
- response = {
472
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
473
- name: errorCode,
474
- $metadata: deserializeMetadata(output),
475
- };
476
- break;
353
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
477
354
  case "ThrottlingException":
478
355
  case "com.amazonaws.healthlake#ThrottlingException":
479
- response = {
480
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
481
- name: errorCode,
482
- $metadata: deserializeMetadata(output),
483
- };
484
- break;
356
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
485
357
  case "ValidationException":
486
358
  case "com.amazonaws.healthlake#ValidationException":
487
- response = {
488
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
489
- name: errorCode,
490
- $metadata: deserializeMetadata(output),
491
- };
492
- break;
359
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
493
360
  default:
494
361
  const parsedBody = parsedOutput.body;
495
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
496
- response = {
497
- ...parsedBody,
498
- name: `${errorCode}`,
499
- message: parsedBody.message || parsedBody.Message || errorCode,
362
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
363
+ name: parsedBody.code || parsedBody.Code || errorCode,
500
364
  $fault: "client",
501
365
  $metadata: deserializeMetadata(output),
502
- };
366
+ });
367
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
503
368
  }
504
- const message = response.message || response.Message || errorCode;
505
- response.message = message;
506
- delete response.Message;
507
- return Promise.reject(Object.assign(new Error(message), response));
508
369
  };
509
370
  const deserializeAws_json1_0ListFHIRDatastoresCommand = async (output, context) => {
510
371
  if (output.statusCode >= 300) {
@@ -531,43 +392,22 @@ const deserializeAws_json1_0ListFHIRDatastoresCommandError = async (output, cont
531
392
  switch (errorCode) {
532
393
  case "InternalServerException":
533
394
  case "com.amazonaws.healthlake#InternalServerException":
534
- response = {
535
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
536
- name: errorCode,
537
- $metadata: deserializeMetadata(output),
538
- };
539
- break;
395
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
540
396
  case "ThrottlingException":
541
397
  case "com.amazonaws.healthlake#ThrottlingException":
542
- response = {
543
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
544
- name: errorCode,
545
- $metadata: deserializeMetadata(output),
546
- };
547
- break;
398
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
548
399
  case "ValidationException":
549
400
  case "com.amazonaws.healthlake#ValidationException":
550
- response = {
551
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
552
- name: errorCode,
553
- $metadata: deserializeMetadata(output),
554
- };
555
- break;
401
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
556
402
  default:
557
403
  const parsedBody = parsedOutput.body;
558
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
559
- response = {
560
- ...parsedBody,
561
- name: `${errorCode}`,
562
- message: parsedBody.message || parsedBody.Message || errorCode,
404
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
405
+ name: parsedBody.code || parsedBody.Code || errorCode,
563
406
  $fault: "client",
564
407
  $metadata: deserializeMetadata(output),
565
- };
408
+ });
409
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
566
410
  }
567
- const message = response.message || response.Message || errorCode;
568
- response.message = message;
569
- delete response.Message;
570
- return Promise.reject(Object.assign(new Error(message), response));
571
411
  };
572
412
  const deserializeAws_json1_0ListFHIRExportJobsCommand = async (output, context) => {
573
413
  if (output.statusCode >= 300) {
@@ -594,59 +434,28 @@ const deserializeAws_json1_0ListFHIRExportJobsCommandError = async (output, cont
594
434
  switch (errorCode) {
595
435
  case "AccessDeniedException":
596
436
  case "com.amazonaws.healthlake#AccessDeniedException":
597
- response = {
598
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
599
- name: errorCode,
600
- $metadata: deserializeMetadata(output),
601
- };
602
- break;
437
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
603
438
  case "InternalServerException":
604
439
  case "com.amazonaws.healthlake#InternalServerException":
605
- response = {
606
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
607
- name: errorCode,
608
- $metadata: deserializeMetadata(output),
609
- };
610
- break;
440
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
611
441
  case "ResourceNotFoundException":
612
442
  case "com.amazonaws.healthlake#ResourceNotFoundException":
613
- response = {
614
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
615
- name: errorCode,
616
- $metadata: deserializeMetadata(output),
617
- };
618
- break;
443
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
619
444
  case "ThrottlingException":
620
445
  case "com.amazonaws.healthlake#ThrottlingException":
621
- response = {
622
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
623
- name: errorCode,
624
- $metadata: deserializeMetadata(output),
625
- };
626
- break;
446
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
627
447
  case "ValidationException":
628
448
  case "com.amazonaws.healthlake#ValidationException":
629
- response = {
630
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
631
- name: errorCode,
632
- $metadata: deserializeMetadata(output),
633
- };
634
- break;
449
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
635
450
  default:
636
451
  const parsedBody = parsedOutput.body;
637
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
638
- response = {
639
- ...parsedBody,
640
- name: `${errorCode}`,
641
- message: parsedBody.message || parsedBody.Message || errorCode,
452
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
453
+ name: parsedBody.code || parsedBody.Code || errorCode,
642
454
  $fault: "client",
643
455
  $metadata: deserializeMetadata(output),
644
- };
456
+ });
457
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
645
458
  }
646
- const message = response.message || response.Message || errorCode;
647
- response.message = message;
648
- delete response.Message;
649
- return Promise.reject(Object.assign(new Error(message), response));
650
459
  };
651
460
  const deserializeAws_json1_0ListFHIRImportJobsCommand = async (output, context) => {
652
461
  if (output.statusCode >= 300) {
@@ -673,59 +482,28 @@ const deserializeAws_json1_0ListFHIRImportJobsCommandError = async (output, cont
673
482
  switch (errorCode) {
674
483
  case "AccessDeniedException":
675
484
  case "com.amazonaws.healthlake#AccessDeniedException":
676
- response = {
677
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
678
- name: errorCode,
679
- $metadata: deserializeMetadata(output),
680
- };
681
- break;
485
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
682
486
  case "InternalServerException":
683
487
  case "com.amazonaws.healthlake#InternalServerException":
684
- response = {
685
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
686
- name: errorCode,
687
- $metadata: deserializeMetadata(output),
688
- };
689
- break;
488
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
690
489
  case "ResourceNotFoundException":
691
490
  case "com.amazonaws.healthlake#ResourceNotFoundException":
692
- response = {
693
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
694
- name: errorCode,
695
- $metadata: deserializeMetadata(output),
696
- };
697
- break;
491
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
698
492
  case "ThrottlingException":
699
493
  case "com.amazonaws.healthlake#ThrottlingException":
700
- response = {
701
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
702
- name: errorCode,
703
- $metadata: deserializeMetadata(output),
704
- };
705
- break;
494
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
706
495
  case "ValidationException":
707
496
  case "com.amazonaws.healthlake#ValidationException":
708
- response = {
709
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
710
- name: errorCode,
711
- $metadata: deserializeMetadata(output),
712
- };
713
- break;
497
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
714
498
  default:
715
499
  const parsedBody = parsedOutput.body;
716
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
717
- response = {
718
- ...parsedBody,
719
- name: `${errorCode}`,
720
- message: parsedBody.message || parsedBody.Message || errorCode,
500
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
501
+ name: parsedBody.code || parsedBody.Code || errorCode,
721
502
  $fault: "client",
722
503
  $metadata: deserializeMetadata(output),
723
- };
504
+ });
505
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
724
506
  }
725
- const message = response.message || response.Message || errorCode;
726
- response.message = message;
727
- delete response.Message;
728
- return Promise.reject(Object.assign(new Error(message), response));
729
507
  };
730
508
  const deserializeAws_json1_0ListTagsForResourceCommand = async (output, context) => {
731
509
  if (output.statusCode >= 300) {
@@ -752,35 +530,19 @@ const deserializeAws_json1_0ListTagsForResourceCommandError = async (output, con
752
530
  switch (errorCode) {
753
531
  case "ResourceNotFoundException":
754
532
  case "com.amazonaws.healthlake#ResourceNotFoundException":
755
- response = {
756
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
757
- name: errorCode,
758
- $metadata: deserializeMetadata(output),
759
- };
760
- break;
533
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
761
534
  case "ValidationException":
762
535
  case "com.amazonaws.healthlake#ValidationException":
763
- response = {
764
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
765
- name: errorCode,
766
- $metadata: deserializeMetadata(output),
767
- };
768
- break;
536
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
769
537
  default:
770
538
  const parsedBody = parsedOutput.body;
771
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
772
- response = {
773
- ...parsedBody,
774
- name: `${errorCode}`,
775
- message: parsedBody.message || parsedBody.Message || errorCode,
539
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
540
+ name: parsedBody.code || parsedBody.Code || errorCode,
776
541
  $fault: "client",
777
542
  $metadata: deserializeMetadata(output),
778
- };
543
+ });
544
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
779
545
  }
780
- const message = response.message || response.Message || errorCode;
781
- response.message = message;
782
- delete response.Message;
783
- return Promise.reject(Object.assign(new Error(message), response));
784
546
  };
785
547
  const deserializeAws_json1_0StartFHIRExportJobCommand = async (output, context) => {
786
548
  if (output.statusCode >= 300) {
@@ -807,59 +569,28 @@ const deserializeAws_json1_0StartFHIRExportJobCommandError = async (output, cont
807
569
  switch (errorCode) {
808
570
  case "AccessDeniedException":
809
571
  case "com.amazonaws.healthlake#AccessDeniedException":
810
- response = {
811
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
812
- name: errorCode,
813
- $metadata: deserializeMetadata(output),
814
- };
815
- break;
572
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
816
573
  case "InternalServerException":
817
574
  case "com.amazonaws.healthlake#InternalServerException":
818
- response = {
819
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
820
- name: errorCode,
821
- $metadata: deserializeMetadata(output),
822
- };
823
- break;
575
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
824
576
  case "ResourceNotFoundException":
825
577
  case "com.amazonaws.healthlake#ResourceNotFoundException":
826
- response = {
827
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
828
- name: errorCode,
829
- $metadata: deserializeMetadata(output),
830
- };
831
- break;
578
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
832
579
  case "ThrottlingException":
833
580
  case "com.amazonaws.healthlake#ThrottlingException":
834
- response = {
835
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
836
- name: errorCode,
837
- $metadata: deserializeMetadata(output),
838
- };
839
- break;
581
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
840
582
  case "ValidationException":
841
583
  case "com.amazonaws.healthlake#ValidationException":
842
- response = {
843
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
844
- name: errorCode,
845
- $metadata: deserializeMetadata(output),
846
- };
847
- break;
584
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
848
585
  default:
849
586
  const parsedBody = parsedOutput.body;
850
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
851
- response = {
852
- ...parsedBody,
853
- name: `${errorCode}`,
854
- message: parsedBody.message || parsedBody.Message || errorCode,
587
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
588
+ name: parsedBody.code || parsedBody.Code || errorCode,
855
589
  $fault: "client",
856
590
  $metadata: deserializeMetadata(output),
857
- };
591
+ });
592
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
858
593
  }
859
- const message = response.message || response.Message || errorCode;
860
- response.message = message;
861
- delete response.Message;
862
- return Promise.reject(Object.assign(new Error(message), response));
863
594
  };
864
595
  const deserializeAws_json1_0StartFHIRImportJobCommand = async (output, context) => {
865
596
  if (output.statusCode >= 300) {
@@ -886,59 +617,28 @@ const deserializeAws_json1_0StartFHIRImportJobCommandError = async (output, cont
886
617
  switch (errorCode) {
887
618
  case "AccessDeniedException":
888
619
  case "com.amazonaws.healthlake#AccessDeniedException":
889
- response = {
890
- ...(await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context)),
891
- name: errorCode,
892
- $metadata: deserializeMetadata(output),
893
- };
894
- break;
620
+ throw await deserializeAws_json1_0AccessDeniedExceptionResponse(parsedOutput, context);
895
621
  case "InternalServerException":
896
622
  case "com.amazonaws.healthlake#InternalServerException":
897
- response = {
898
- ...(await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context)),
899
- name: errorCode,
900
- $metadata: deserializeMetadata(output),
901
- };
902
- break;
623
+ throw await deserializeAws_json1_0InternalServerExceptionResponse(parsedOutput, context);
903
624
  case "ResourceNotFoundException":
904
625
  case "com.amazonaws.healthlake#ResourceNotFoundException":
905
- response = {
906
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
907
- name: errorCode,
908
- $metadata: deserializeMetadata(output),
909
- };
910
- break;
626
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
911
627
  case "ThrottlingException":
912
628
  case "com.amazonaws.healthlake#ThrottlingException":
913
- response = {
914
- ...(await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context)),
915
- name: errorCode,
916
- $metadata: deserializeMetadata(output),
917
- };
918
- break;
629
+ throw await deserializeAws_json1_0ThrottlingExceptionResponse(parsedOutput, context);
919
630
  case "ValidationException":
920
631
  case "com.amazonaws.healthlake#ValidationException":
921
- response = {
922
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
923
- name: errorCode,
924
- $metadata: deserializeMetadata(output),
925
- };
926
- break;
632
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
927
633
  default:
928
634
  const parsedBody = parsedOutput.body;
929
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
930
- response = {
931
- ...parsedBody,
932
- name: `${errorCode}`,
933
- message: parsedBody.message || parsedBody.Message || errorCode,
635
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
636
+ name: parsedBody.code || parsedBody.Code || errorCode,
934
637
  $fault: "client",
935
638
  $metadata: deserializeMetadata(output),
936
- };
639
+ });
640
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
937
641
  }
938
- const message = response.message || response.Message || errorCode;
939
- response.message = message;
940
- delete response.Message;
941
- return Promise.reject(Object.assign(new Error(message), response));
942
642
  };
943
643
  const deserializeAws_json1_0TagResourceCommand = async (output, context) => {
944
644
  if (output.statusCode >= 300) {
@@ -965,35 +665,19 @@ const deserializeAws_json1_0TagResourceCommandError = async (output, context) =>
965
665
  switch (errorCode) {
966
666
  case "ResourceNotFoundException":
967
667
  case "com.amazonaws.healthlake#ResourceNotFoundException":
968
- response = {
969
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
970
- name: errorCode,
971
- $metadata: deserializeMetadata(output),
972
- };
973
- break;
668
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
974
669
  case "ValidationException":
975
670
  case "com.amazonaws.healthlake#ValidationException":
976
- response = {
977
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
978
- name: errorCode,
979
- $metadata: deserializeMetadata(output),
980
- };
981
- break;
671
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
982
672
  default:
983
673
  const parsedBody = parsedOutput.body;
984
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
985
- response = {
986
- ...parsedBody,
987
- name: `${errorCode}`,
988
- message: parsedBody.message || parsedBody.Message || errorCode,
674
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
675
+ name: parsedBody.code || parsedBody.Code || errorCode,
989
676
  $fault: "client",
990
677
  $metadata: deserializeMetadata(output),
991
- };
678
+ });
679
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
992
680
  }
993
- const message = response.message || response.Message || errorCode;
994
- response.message = message;
995
- delete response.Message;
996
- return Promise.reject(Object.assign(new Error(message), response));
997
681
  };
998
682
  const deserializeAws_json1_0UntagResourceCommand = async (output, context) => {
999
683
  if (output.statusCode >= 300) {
@@ -1020,101 +704,73 @@ const deserializeAws_json1_0UntagResourceCommandError = async (output, context)
1020
704
  switch (errorCode) {
1021
705
  case "ResourceNotFoundException":
1022
706
  case "com.amazonaws.healthlake#ResourceNotFoundException":
1023
- response = {
1024
- ...(await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context)),
1025
- name: errorCode,
1026
- $metadata: deserializeMetadata(output),
1027
- };
1028
- break;
707
+ throw await deserializeAws_json1_0ResourceNotFoundExceptionResponse(parsedOutput, context);
1029
708
  case "ValidationException":
1030
709
  case "com.amazonaws.healthlake#ValidationException":
1031
- response = {
1032
- ...(await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context)),
1033
- name: errorCode,
1034
- $metadata: deserializeMetadata(output),
1035
- };
1036
- break;
710
+ throw await deserializeAws_json1_0ValidationExceptionResponse(parsedOutput, context);
1037
711
  default:
1038
712
  const parsedBody = parsedOutput.body;
1039
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1040
- response = {
1041
- ...parsedBody,
1042
- name: `${errorCode}`,
1043
- message: parsedBody.message || parsedBody.Message || errorCode,
713
+ response = new HealthLakeServiceException_1.HealthLakeServiceException({
714
+ name: parsedBody.code || parsedBody.Code || errorCode,
1044
715
  $fault: "client",
1045
716
  $metadata: deserializeMetadata(output),
1046
- };
717
+ });
718
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1047
719
  }
1048
- const message = response.message || response.Message || errorCode;
1049
- response.message = message;
1050
- delete response.Message;
1051
- return Promise.reject(Object.assign(new Error(message), response));
1052
720
  };
1053
721
  const deserializeAws_json1_0AccessDeniedExceptionResponse = async (parsedOutput, context) => {
1054
722
  const body = parsedOutput.body;
1055
723
  const deserialized = deserializeAws_json1_0AccessDeniedException(body, context);
1056
- const contents = {
1057
- name: "AccessDeniedException",
1058
- $fault: "client",
724
+ const exception = new models_0_1.AccessDeniedException({
1059
725
  $metadata: deserializeMetadata(parsedOutput),
1060
726
  ...deserialized,
1061
- };
1062
- return contents;
727
+ });
728
+ return smithy_client_1.decorateServiceException(exception, body);
1063
729
  };
1064
730
  const deserializeAws_json1_0ConflictExceptionResponse = async (parsedOutput, context) => {
1065
731
  const body = parsedOutput.body;
1066
732
  const deserialized = deserializeAws_json1_0ConflictException(body, context);
1067
- const contents = {
1068
- name: "ConflictException",
1069
- $fault: "client",
733
+ const exception = new models_0_1.ConflictException({
1070
734
  $metadata: deserializeMetadata(parsedOutput),
1071
735
  ...deserialized,
1072
- };
1073
- return contents;
736
+ });
737
+ return smithy_client_1.decorateServiceException(exception, body);
1074
738
  };
1075
739
  const deserializeAws_json1_0InternalServerExceptionResponse = async (parsedOutput, context) => {
1076
740
  const body = parsedOutput.body;
1077
741
  const deserialized = deserializeAws_json1_0InternalServerException(body, context);
1078
- const contents = {
1079
- name: "InternalServerException",
1080
- $fault: "server",
742
+ const exception = new models_0_1.InternalServerException({
1081
743
  $metadata: deserializeMetadata(parsedOutput),
1082
744
  ...deserialized,
1083
- };
1084
- return contents;
745
+ });
746
+ return smithy_client_1.decorateServiceException(exception, body);
1085
747
  };
1086
748
  const deserializeAws_json1_0ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
1087
749
  const body = parsedOutput.body;
1088
750
  const deserialized = deserializeAws_json1_0ResourceNotFoundException(body, context);
1089
- const contents = {
1090
- name: "ResourceNotFoundException",
1091
- $fault: "client",
751
+ const exception = new models_0_1.ResourceNotFoundException({
1092
752
  $metadata: deserializeMetadata(parsedOutput),
1093
753
  ...deserialized,
1094
- };
1095
- return contents;
754
+ });
755
+ return smithy_client_1.decorateServiceException(exception, body);
1096
756
  };
1097
757
  const deserializeAws_json1_0ThrottlingExceptionResponse = async (parsedOutput, context) => {
1098
758
  const body = parsedOutput.body;
1099
759
  const deserialized = deserializeAws_json1_0ThrottlingException(body, context);
1100
- const contents = {
1101
- name: "ThrottlingException",
1102
- $fault: "client",
760
+ const exception = new models_0_1.ThrottlingException({
1103
761
  $metadata: deserializeMetadata(parsedOutput),
1104
762
  ...deserialized,
1105
- };
1106
- return contents;
763
+ });
764
+ return smithy_client_1.decorateServiceException(exception, body);
1107
765
  };
1108
766
  const deserializeAws_json1_0ValidationExceptionResponse = async (parsedOutput, context) => {
1109
767
  const body = parsedOutput.body;
1110
768
  const deserialized = deserializeAws_json1_0ValidationException(body, context);
1111
- const contents = {
1112
- name: "ValidationException",
1113
- $fault: "client",
769
+ const exception = new models_0_1.ValidationException({
1114
770
  $metadata: deserializeMetadata(parsedOutput),
1115
771
  ...deserialized,
1116
- };
1117
- return contents;
772
+ });
773
+ return smithy_client_1.decorateServiceException(exception, body);
1118
774
  };
1119
775
  const serializeAws_json1_0CreateFHIRDatastoreRequest = (input, context) => {
1120
776
  var _a;
@@ -1353,7 +1009,7 @@ const deserializeAws_json1_0DatastoreProperties = (output, context) => {
1353
1009
  };
1354
1010
  };
1355
1011
  const deserializeAws_json1_0DatastorePropertiesList = (output, context) => {
1356
- return (output || [])
1012
+ const retVal = (output || [])
1357
1013
  .filter((e) => e != null)
1358
1014
  .map((entry) => {
1359
1015
  if (entry === null) {
@@ -1361,6 +1017,7 @@ const deserializeAws_json1_0DatastorePropertiesList = (output, context) => {
1361
1017
  }
1362
1018
  return deserializeAws_json1_0DatastoreProperties(entry, context);
1363
1019
  });
1020
+ return retVal;
1364
1021
  };
1365
1022
  const deserializeAws_json1_0DeleteFHIRDatastoreResponse = (output, context) => {
1366
1023
  return {
@@ -1411,7 +1068,7 @@ const deserializeAws_json1_0ExportJobProperties = (output, context) => {
1411
1068
  };
1412
1069
  };
1413
1070
  const deserializeAws_json1_0ExportJobPropertiesList = (output, context) => {
1414
- return (output || [])
1071
+ const retVal = (output || [])
1415
1072
  .filter((e) => e != null)
1416
1073
  .map((entry) => {
1417
1074
  if (entry === null) {
@@ -1419,6 +1076,7 @@ const deserializeAws_json1_0ExportJobPropertiesList = (output, context) => {
1419
1076
  }
1420
1077
  return deserializeAws_json1_0ExportJobProperties(entry, context);
1421
1078
  });
1079
+ return retVal;
1422
1080
  };
1423
1081
  const deserializeAws_json1_0ImportJobProperties = (output, context) => {
1424
1082
  return {
@@ -1443,7 +1101,7 @@ const deserializeAws_json1_0ImportJobProperties = (output, context) => {
1443
1101
  };
1444
1102
  };
1445
1103
  const deserializeAws_json1_0ImportJobPropertiesList = (output, context) => {
1446
- return (output || [])
1104
+ const retVal = (output || [])
1447
1105
  .filter((e) => e != null)
1448
1106
  .map((entry) => {
1449
1107
  if (entry === null) {
@@ -1451,6 +1109,7 @@ const deserializeAws_json1_0ImportJobPropertiesList = (output, context) => {
1451
1109
  }
1452
1110
  return deserializeAws_json1_0ImportJobProperties(entry, context);
1453
1111
  });
1112
+ return retVal;
1454
1113
  };
1455
1114
  const deserializeAws_json1_0InputDataConfig = (output, context) => {
1456
1115
  if (smithy_client_1.expectString(output.S3Uri) !== undefined) {
@@ -1552,7 +1211,7 @@ const deserializeAws_json1_0Tag = (output, context) => {
1552
1211
  };
1553
1212
  };
1554
1213
  const deserializeAws_json1_0TagList = (output, context) => {
1555
- return (output || [])
1214
+ const retVal = (output || [])
1556
1215
  .filter((e) => e != null)
1557
1216
  .map((entry) => {
1558
1217
  if (entry === null) {
@@ -1560,6 +1219,7 @@ const deserializeAws_json1_0TagList = (output, context) => {
1560
1219
  }
1561
1220
  return deserializeAws_json1_0Tag(entry, context);
1562
1221
  });
1222
+ return retVal;
1563
1223
  };
1564
1224
  const deserializeAws_json1_0TagResourceResponse = (output, context) => {
1565
1225
  return {};