MCPcopy Create free account
hub / github.com/pollinations/pollinations / emitServerError

Function emitServerError

shared/error.ts:373–402  ·  view source on GitHub ↗
(
    c: Context<TEnv>,
    error: Error,
    status: number,
    timestamp: string,
    log: Logger,
)

Source from the content-addressed store, hash-verified

371}
372
373async 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
404async function createServerErrorEnvelope<TEnv extends ErrorHandlerEnv>(
405 c: Context<TEnv>,

Callers 1

handleErrorFunction · 0.85

Calls 6

sendErrorEventToTinybirdFunction · 0.90
toTinybirdErrorEventFunction · 0.85
errorMethod · 0.80
waitUntilMethod · 0.65

Tested by

no test coverage detected