diff --git a/package.json b/package.json index e08d6e6..e6a6ecf 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "cors": "^2.8.5", "errorhandler": "^1.5.1", "express": "^4.17.1", - "fhir-works-on-aws-interface": "^9.0.0", + "fhir-works-on-aws-interface": "^9.1.0", "flat": "^5.0.0", "http-errors": "^1.8.0", "lodash": "^4.17.15", diff --git a/src/router/routes/errorHandling.ts b/src/router/routes/errorHandling.ts index e805fff..d351bd7 100644 --- a/src/router/routes/errorHandling.ts +++ b/src/router/routes/errorHandling.ts @@ -9,6 +9,7 @@ import { IssueSeverity, IssueCode, isInvalidSearchParameterError, + isResourceConflictError, } from 'fhir-works-on-aws-interface'; import OperationsGenerator from '../operationsGenerator'; @@ -43,6 +44,10 @@ export const applicationErrorMapper = ( next(new createError.BadRequest(err.message)); return; } + if (isResourceConflictError(err)) { + next(new createError.Conflict(err.message)); + return; + } next(err); }; @@ -50,6 +55,7 @@ const statusToOutcome: Record