diff --git a/apps/web/pages/api/trpc/[trpc].ts b/apps/web/pages/api/trpc/[trpc].ts index d2f86de..3e78ce9 100644 --- a/apps/web/pages/api/trpc/[trpc].ts +++ b/apps/web/pages/api/trpc/[trpc].ts @@ -23,16 +23,17 @@ export default trpcNext.createNextApiHandler({ onError(opts) { const { error } = opts; // send to bug reporting - withScope((scope) => { - (Object.keys(opts) as Array).forEach((key) => { - if (key !== 'req') { - let extra = opts[key]; - if (key === 'input') extra = JSON.stringify(extra); - scope.setExtra(key, extra); - } + if (!['BAD_REQUEST', 'UNAUTHORIZED', 'FORBIDDEN'].includes(error.code)) + withScope((scope) => { + (Object.keys(opts) as Array).forEach((key) => { + if (key !== 'req') { + let extra = opts[key]; + if (key === 'input') extra = JSON.stringify(extra); + scope.setExtra(key, extra); + } + }); + captureException(error); }); - captureException(error); - }); // eslint-disable-next-line no-console console.error('Something went wrong', error); },