fix: update error logging

This commit is contained in:
David Nguyen
2025-03-04 01:41:39 +11:00
parent e08d62c844
commit 7c38970ee8
4 changed files with 13 additions and 5 deletions

View File

@ -62,7 +62,7 @@ export const GenericErrorLayout = ({
const team = useOptionalCurrentTeam();
const { subHeading, heading, message } =
errorCodeMap[errorCode || 404] ?? defaultErrorCodeMap[500];
errorCodeMap[errorCode || 500] ?? defaultErrorCodeMap[500];
return (
<div className="fixed inset-0 z-0 flex h-screen w-screen items-center justify-center">

View File

@ -1,7 +1,6 @@
import { useEffect } from 'react';
import Plausible from 'plausible-tracker';
import posthog from 'posthog-js';
import {
Links,
Meta,
@ -181,7 +180,6 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
if (errorCode !== 404) {
console.error('[RootErrorBoundary]', error);
posthog.captureException(error);
}
return <GenericErrorLayout errorCode={errorCode} />;

View File

@ -19,6 +19,10 @@ const posthogProxy = async (request: Request) => {
const headers = new Headers(request.headers);
headers.set('host', hostname);
headers.delete('connection');
headers.delete('content-length');
headers.delete('cookie');
const response = await fetch(newUrl, {
method: request.method,
headers,

View File

@ -1,4 +1,4 @@
import { fetchRequestHandler } from '@ts-rest/serverless/fetch';
import { TsRestHttpError, fetchRequestHandler } from '@ts-rest/serverless/fetch';
import { Hono } from 'hono';
import { ApiContractV1 } from '@documenso/api/v1/contract';
@ -29,6 +29,12 @@ tsRestHonoApp.mount('/', async (request) => {
request,
contract: ApiContractV1,
router: ApiContractV1Implementation,
options: {},
options: {
errorHandler: (err) => {
if (err instanceof TsRestHttpError && err.statusCode === 500) {
console.error(err);
}
},
},
});
});