(
c: Context<TEnv>,
error: Error,
status: number,
timestamp: string,
log: Logger,
)
| 371 | } |
| 372 | |
| 373 | async function emitServerError<TEnv extends ErrorHandlerEnv>( |
| 374 | c: Context<TEnv>, |
| 375 | error: Error, |
| 376 | status: number, |
| 377 | timestamp: string, |
| 378 | log: Logger, |
| 379 | ): Promise<void> { |
| 380 | const envelope = await createServerErrorEnvelope( |
| 381 | c, |
| 382 | error, |
| 383 | status, |
| 384 | timestamp, |
| 385 | ); |
| 386 | log.error( |
| 387 | "server_error route={routePath} status={status} class={errorClass}", |
| 388 | envelope, |
| 389 | ); |
| 390 | |
| 391 | c.executionCtx.waitUntil( |
| 392 | sendErrorEventToTinybird( |
| 393 | toTinybirdErrorEvent(envelope), |
| 394 | getTinybirdDatasourceIngestUrl( |
| 395 | c.env.TINYBIRD_INGEST_URL, |
| 396 | "error_event", |
| 397 | ), |
| 398 | c.env.TINYBIRD_INGEST_TOKEN, |
| 399 | log, |
| 400 | ), |
| 401 | ); |
| 402 | } |
| 403 | |
| 404 | async function createServerErrorEnvelope<TEnv extends ErrorHandlerEnv>( |
| 405 | c: Context<TEnv>, |
no test coverage detected