Skip to content

Commit

Permalink
Log errors in APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
frostehhh committed Sep 24, 2023
1 parent 1b5afbe commit 0887273
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/functions/src/common/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ export const handleSuccessfulResponse = ({ body }: { body: unknown }) => ( {
headers: commonResponseHeaders,
});

export const handleResponseError = ({ error }: { error: unknown }) => ({
statusCode: StatusCodes.INTERNAL_SERVER_ERROR,
body: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
error,
},
headers: commonResponseHeaders,
});
export const handleResponseError = ({ error }: { error: unknown }) => {
console.log('Error', error);

return {
statusCode: StatusCodes.INTERNAL_SERVER_ERROR,
body: {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
error,
},
headers: commonResponseHeaders,
};
};

0 comments on commit 0887273

Please sign in to comment.