1- from enum import Enum
1+ from enum import Enum , StrEnum
22from typing import Optional
33
44from enums .fhir .fhir_issue_type import FhirIssueCoding , UKCoreSpineError
55from utils .error_response import ErrorResponse
66from utils .request_context import request_context
77
8-
9- class LambdaError (Enum ):
8+ class ErrorMessage (StrEnum ):
109 MISSING_POST = "Missing POST request body"
1110 MISSING_KEY = "An error occurred due to missing key"
1211 RETRIEVE_DOCUMENTS = "Unable to retrieve documents for patient"
12+ FAILED_TO_QUERY_DYNAMO = "Failed to query DynamoDB"
13+ FAILED_TO_VALIDATE = "Failed to validate data"
14+ FAILED_TO_UPDATE_DYNAMO = "Failed to update DynamoDB"
15+ FAILED_TO_CREATE_TRANSACTION = "Failed to create transaction"
16+
17+ class LambdaError (Enum ):
1318
1419 def create_error_response (
1520 self , params : Optional [dict ] = None , ** kwargs
@@ -240,15 +245,15 @@ def create_error_body(self, params: Optional[dict] = None, **kwargs) -> str:
240245 }
241246 ManifestMissingBody = {
242247 "err_code" : "DMS_4002" ,
243- "message" : MISSING_POST ,
248+ "message" : ErrorMessage . MISSING_POST ,
244249 }
245250 ManifestFilterDocumentReferences = {
246251 "err_code" : "DMS_4003" ,
247252 "message" : "Selected document references do not match any documents stored for this patient" ,
248253 }
249254 ManifestMissingJobId = {
250255 "err_code" : "DMS_4004" ,
251- "message" : MISSING_KEY ,
256+ "message" : ErrorMessage . MISSING_KEY ,
252257 }
253258 ManifestMissingJob = {
254259 "err_code" : "DMS_4005" ,
@@ -272,19 +277,19 @@ def create_error_body(self, params: Optional[dict] = None, **kwargs) -> str:
272277 }
273278 StitchNoService = {
274279 "err_code" : "LGS_5001" ,
275- "message" : RETRIEVE_DOCUMENTS ,
280+ "message" : ErrorMessage . RETRIEVE_DOCUMENTS ,
276281 }
277282 StitchClient = {
278283 "err_code" : "LGS_5002" ,
279284 "message" : "Unable to return stitched pdf file due to internal error" ,
280285 }
281286 StitchDB = {
282287 "err_code" : "LGS_5003" ,
283- "message" : RETRIEVE_DOCUMENTS ,
288+ "message" : ErrorMessage . RETRIEVE_DOCUMENTS ,
284289 }
285290 StitchValidation = {
286291 "err_code" : "LGS_5004" ,
287- "message" : RETRIEVE_DOCUMENTS ,
292+ "message" : ErrorMessage . RETRIEVE_DOCUMENTS ,
288293 }
289294 StitchCloudFront = {
290295 "err_code" : "LGS_5005" ,
@@ -325,7 +330,7 @@ def create_error_body(self, params: Optional[dict] = None, **kwargs) -> str:
325330 """
326331 FeedbackMissingBody = {
327332 "err_code" : "SFB_4001" ,
328- "message" : MISSING_POST ,
333+ "message" : ErrorMessage . MISSING_POST ,
329334 }
330335
331336 FeedbackInvalidBody = {
@@ -612,7 +617,7 @@ def create_error_body(self, params: Optional[dict] = None, **kwargs) -> str:
612617 }
613618 DocTypeKey = {
614619 "err_code" : "VDT_4003" ,
615- "message" : MISSING_KEY ,
620+ "message" : ErrorMessage . MISSING_KEY ,
616621 }
617622 PatientIdInvalid = {
618623 "err_code" : "PN_4001" ,
@@ -621,7 +626,7 @@ def create_error_body(self, params: Optional[dict] = None, **kwargs) -> str:
621626 }
622627 PatientIdNoKey = {
623628 "err_code" : "PN_4002" ,
624- "message" : MISSING_KEY ,
629+ "message" : ErrorMessage . MISSING_KEY ,
625630 "fhir_coding" : UKCoreSpineError .MISSING_VALUE ,
626631 }
627632 PatientIdMismatch = {
@@ -671,7 +676,7 @@ def create_error_body(self, params: Optional[dict] = None, **kwargs) -> str:
671676 """
672677 DocumentReviewDB = {
673678 "err_code" : "UDR_5001" ,
674- "message" : RETRIEVE_DOCUMENTS ,
679+ "message" : ErrorMessage . RETRIEVE_DOCUMENTS ,
675680 }
676681
677682 DocumentReviewValidation = {
0 commit comments