Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a special logging tag to uncaught handler exceptions #266

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions logging/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export type Tags =
| 'invariant-violation'
| 'state-transition'
| 'invalid-request'
| 'unhealthy-session';
| 'unhealthy-session'
| 'uncaught-handler-error';

const cleanedLogFn = (log: LogFn) => {
return (msg: string, metadata?: MessageMetadata) => {
Expand Down Expand Up @@ -53,7 +54,7 @@ export type MessageMetadata = Partial<{
traceId: string;
spanId: string;
};
extras: unknown;
extras?: Record<string, unknown>;
}>;

export class BaseLogger implements Logger {
Expand Down
2 changes: 2 additions & 0 deletions router/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@ class RiverServer<Services extends AnyServiceSchemaMap>
},
extras: {
error: errorMsg,
originalException: err,
},
tags: ['uncaught-handler-error'],
},
);

Expand Down
4 changes: 2 additions & 2 deletions transport/impls/ws/connection.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Connection } from '../../connection';
import { WsLike } from './wslike';

interface ConnectionInfoExtras {
headers: Record<string, string>;
interface ConnectionInfoExtras extends Record<string, unknown> {
headers: Record<string, unknown>;
masad-frost marked this conversation as resolved.
Show resolved Hide resolved
masad-frost marked this conversation as resolved.
Show resolved Hide resolved
}

const WS_HEALTHY_CLOSE_CODE = 1000;
Expand Down
Loading