Skip to content

Commit

Permalink
chore: add more information to null operation log message (#3125)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigzour authored Jan 16, 2024
1 parent eb4ba76 commit 0157a0f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pages/api/templates/[formID].ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ const templates = async (req: NextApiRequest, res: NextApiResponse, props: Middl
...req.body,
});

if (!response) throw new Error("Null operation response");
if (!response)
throw new Error(
`Template API response was null. Request information: method = ${
req.method
} ; query = ${JSON.stringify(req.query)} ; body = ${JSON.stringify(req.body)}`
);

return res.status(200).json(response);
} catch (e) {
Expand Down
7 changes: 6 additions & 1 deletion pages/api/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ const templates = async (req: NextApiRequest, res: NextApiResponse, props: Middl
...req.body,
});

if (!response) throw new Error("Null operation response");
if (!response)
throw new Error(
`Template API response was null. Request information: method = ${
req.method
} ; query = ${JSON.stringify(req.query)} ; body = ${JSON.stringify(req.body)}`
);

return res.status(200).json(response);
} catch (e) {
Expand Down

0 comments on commit 0157a0f

Please sign in to comment.