improve error message if sdk request fails
This commit is contained in:
@@ -18,7 +18,10 @@ const eventRouter: FastifyPluginCallback = (fastify, opts, done) => {
|
||||
) => {
|
||||
try {
|
||||
const projectId = await validateSdkRequest(req.headers).catch(
|
||||
logger.error
|
||||
(error) => {
|
||||
logger.error(error, 'Failed to validate sdk request');
|
||||
return null;
|
||||
}
|
||||
);
|
||||
if (!projectId) {
|
||||
return reply.status(401).send();
|
||||
|
||||
@@ -7,9 +7,10 @@ import type { FastifyPluginCallback } from 'fastify';
|
||||
const eventRouter: FastifyPluginCallback = (fastify, opts, done) => {
|
||||
fastify.addHook('preHandler', async (req, reply) => {
|
||||
try {
|
||||
const projectId = await validateSdkRequest(req.headers).catch(
|
||||
logger.error
|
||||
);
|
||||
const projectId = await validateSdkRequest(req.headers).catch((error) => {
|
||||
logger.error(error, 'Failed to validate sdk request');
|
||||
return null;
|
||||
});
|
||||
if (!projectId) {
|
||||
return reply.status(401).send();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user