Skip to content

Commit e921db4

Browse files
committed
try new catch
1 parent 37e0797 commit e921db4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/api/lambda.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ const handler = async (event: APIGatewayEvent, context: Context) => {
1717
return "warmed";
1818
}
1919
// else proceed with handler logic
20-
try {
21-
return realHandler(event, context);
22-
} catch (e) {
20+
return realHandler(event, context).catch((e) => {
2321
console.error(e);
2422
const newError = new InternalServerError({
2523
message: "Failed to initialize application.",
@@ -33,7 +31,7 @@ const handler = async (event: APIGatewayEvent, context: Context) => {
3331
},
3432
isBase64Encoded: false,
3533
};
36-
}
34+
});
3735
};
3836

3937
await app.ready(); // needs to be placed after awsLambdaFastify call because of the decoration: https://github.com/fastify/aws-lambda-fastify/blob/master/index.js#L9

0 commit comments

Comments
 (0)