Effect CommunityEC
Effect Community3y ago
18 replies
Sly

Best practices for logging errors in TypeScript

Hey guys,

How are you usually logging your errors? I've got a yieldable error like:
export class SomeError extends Data.TaggedError('SomeError')<{
    someStatusCode?:SomeStatusCode;
    originalError?: unknown;
    errors?: Array<{ message: string; type: string }>;
}> {}

That running through: Effect.tapErrorCause(Effect.logError), is logged in such a manner: level=ERROR fiber=#42 cause="SomeError:. It doesn't include any of the added properties. Are there any best practices around this?
Was this page helpful?