Skip to content

Commit 6644f4e

Browse files
committed
fix error enum
1 parent 82e105d commit 6644f4e

5 files changed

Lines changed: 6 additions & 7 deletions

File tree

lambdas/api-handler/src/contracts/errors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export enum ApiErrorStatus {
2828
}
2929

3030
export enum ApiErrorDetail {
31-
NotFoundLetterId = "No resource found with that ID",
32-
NotFoundMiId = "No resource found with that ID",
31+
NotFoundId = "No resource found with that ID",
3332
InvalidRequestMissingBody = "The request is missing the body",
3433
InvalidRequestMissingLetterIdPathParameter = "The request is missing the letter id path parameter",
3534
InvalidRequestLetterIdsMismatch = "The letter ID in the request body does not match the letter ID path parameter",

lambdas/api-handler/src/handlers/__tests__/get-letter.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe("API Lambda handler", () => {
120120
it("returns 404 Not Found when letter matching id is not found", async () => {
121121
const mockedGetLetterById = letterService.getLetterById as jest.Mock;
122122
mockedGetLetterById.mockImplementation(() => {
123-
throw new NotFoundError(ApiErrorDetail.NotFoundLetterId);
123+
throw new NotFoundError(ApiErrorDetail.NotFoundId);
124124
});
125125

126126
const event = makeApiGwEvent({

lambdas/api-handler/src/handlers/__tests__/get-mi.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe("API Lambda handler", () => {
8383
const mockedGetMiById = getMiOperation as jest.Mock;
8484

8585
mockedGetMiById.mockImplementation(() => {
86-
throw new NotFoundError(ApiErrorDetail.NotFoundMiId);
86+
throw new NotFoundError(ApiErrorDetail.NotFoundId);
8787
});
8888

8989
const event = makeApiGwEvent({

lambdas/api-handler/src/mappers/__tests__/error-mapper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("processError", () => {
3535
});
3636

3737
it("should map NotFoundError to NotFound response", () => {
38-
const err = new NotFoundError(ApiErrorDetail.NotFoundLetterId);
38+
const err = new NotFoundError(ApiErrorDetail.NotFoundId);
3939

4040
const res = processError(err, undefined, {
4141
info: jest.fn(),

lambdas/api-handler/src/services/letter-operations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const getLetterById = async (
5151
letter = await letterRepo.getLetterById(supplierId, letterId);
5252
} catch (error) {
5353
if (isNotFoundError(error)) {
54-
throw new NotFoundError(ApiErrorDetail.NotFoundLetterId);
54+
throw new NotFoundError(ApiErrorDetail.NotFoundId);
5555
}
5656
throw error;
5757
}
@@ -75,7 +75,7 @@ export const getLetterDataUrl = async (
7575
);
7676
} catch (error) {
7777
if (isNotFoundError(error)) {
78-
throw new NotFoundError(ApiErrorDetail.NotFoundLetterId);
78+
throw new NotFoundError(ApiErrorDetail.NotFoundId);
7979
}
8080
throw error;
8181
}

0 commit comments

Comments
 (0)