Skip to content

Commit 3c6d8c6

Browse files
Add more details to error msgs #217
1 parent f72598d commit 3c6d8c6

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

apps/api/src/routes/upload.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ const uploadRoute: FastifyPluginAsync = async function (server) {
3333
} catch (err) {
3434
Sentry.captureException(err);
3535
await postSlackMessage({
36-
text: `Failed to upload file with error: ${
36+
text: `Failed to parse uploaded file with error: ${
3737
err.detail ?? err.message
38-
}. Request ID: ${request.id}`,
38+
}. Request ID: ${request.id}. ${
39+
request.headers["api-user"]
40+
? `API User: ${request.headers["api-user"]}`
41+
: ""
42+
}}`,
3943
});
4044
throw err;
4145
}

apps/api/src/services/sendgrid.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export async function sendReportEmail({
3030
const emailSend = await sgMail.send(msg);
3131

3232
if (emailSend[0].statusCode !== 202) {
33-
throw new Error(`Failed to send Email. Status: ${emailSend[0].statusCode}`);
33+
throw new Error(
34+
`Failed to send Email. Status: ${emailSend[0].statusCode}. Recipient: ${email}}`,
35+
);
3436
}
3537
}
3638

@@ -53,6 +55,8 @@ export async function sendFailureEmail({
5355
const emailSend = await sgMail.send(msg);
5456

5557
if (emailSend[0].statusCode !== 202) {
56-
throw new Error(`Failed to send Email. Status: ${emailSend[0].statusCode}`);
58+
throw new Error(
59+
`Failed to send Email. Status: ${emailSend[0].statusCode}. Recipient: ${email}`,
60+
);
5761
}
5862
}

0 commit comments

Comments
 (0)