Skip to content

Commit 6831f1d

Browse files
authored
fix: do not send 500 for invalid media type (#7357)
1 parent 727e525 commit 6831f1d

File tree

1 file changed

+9
-0
lines changed
  • packages/services/service-common/src

1 file changed

+9
-0
lines changed

packages/services/service-common/src/sentry.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ const plugin: FastifyPluginAsync = async server => {
3737
return;
3838
}
3939

40+
if (err.code === 'FST_ERR_CTP_INVALID_MEDIA_TYPE') {
41+
req.log.warn('Invalid media type');
42+
void reply.status(415).send({
43+
error: 415,
44+
message: 'Invalid media type',
45+
});
46+
return;
47+
}
48+
4049
req.log.warn('Replying with 500 Internal Server Error');
4150
void reply.status(500).send({
4251
error: 500,

0 commit comments

Comments
 (0)