Skip to content

Commit 6f7ba80

Browse files
committed
Changed error message
1 parent e15a98c commit 6f7ba80

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ export enum ApiErrorDetail {
3535
InvalidRequestLimitNotANumber = 'The limit parameter is not a number',
3636
InvalidRequestLimitNotInRange = 'The limit parameter must be a positive number not greater than %s',
3737
InvalidRequestLimitOnly = "Only 'limit' query parameter is supported",
38-
InvalidRequestNoRequestId = 'The request does not contain a request id'
38+
InvalidRequestNoRequestId = 'The request does not contain a request id',
39+
InvalidRequestTimestamp = 'Timestamps should be UTC date/times in ISO8601 format, with a Z suffix'
3940
}
4041

4142
export function buildApiError(params: {

lambdas/api-handler/src/handlers/post-mi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const postMi: APIGatewayProxyHandler = async (event) => {
4848

4949
const date = new Date(timestamp);
5050
if (Number.isNaN(date.valueOf()) || date.toISOString() !== timestamp) {
51-
throw new ValidationError('%s is not a valid ISO8601 instant', {args: [timestamp]});
51+
throw new ValidationError(ApiErrorDetail.InvalidRequestTimestamp);
5252
}
5353
}
5454
};

0 commit comments

Comments
 (0)