Skip to content

Commit

Permalink
feat: Try to prevent crash of the application due to timeout (visible…
Browse files Browse the repository at this point in the history
… in ref logs)
  • Loading branch information
ptbrowne committed Sep 26, 2023
1 parent 6cf0339 commit 0c41cf4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ const graphql: NextApiHandler = async (req, res) => {
res.status(200).end();
}

await handler(req, res);
try {
await handler(req, res);
} catch (e) {
res.status(500).send(`Error: ${e instanceof Error ? e.message : `${e}`}`);
}
};

export default graphql;

1 comment on commit 0c41cf4

@vercel
Copy link

@vercel vercel bot commented on 0c41cf4 Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.