diff --git a/packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts b/packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts index 56ffb0dbc3..522de3454f 100644 --- a/packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts +++ b/packages/cactus-core/src/main/typescript/web-services/handle-rest-endpoint-exception.ts @@ -1,10 +1,16 @@ +import type { Response } from "express"; +import createHttpError from "http-errors"; + +import { + identifierByCodes, + INTERNAL_SERVER_ERROR, +} from "http-errors-enhanced-cjs"; + import { Logger, createRuntimeErrorWithCause, safeStringifyException, } from "@hyperledger/cactus-common"; -import type { Response } from "express"; -import createHttpError from "http-errors"; /** * An interface describing the object containing the contextual information needed by the @@ -41,10 +47,6 @@ export async function handleRestEndpointException( ): Promise { const errorAsSanitizedJson = safeStringifyException(ctx.error); - const { identifierByCodes, INTERNAL_SERVER_ERROR } = await import( - "http-errors-enhanced-cjs" - ); - if (createHttpError.isHttpError(ctx.error)) { ctx.res.status(ctx.error.statusCode);