Skip to content
13 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Plan: the inbox, then channels and apps, instead of discussions1/**
2 * A call whose failure should not take the whole page down: the page
3 * shows what it has and says what did not answer. No Workers imports.
4 */
5export type Settled<T> = { ok: true; value: T } | { ok: false; error: string };
6
7export async function settle<T>(promise: Promise<T>): Promise<Settled<T>> {
8 try {
9 return { ok: true, value: await promise };
10 } catch (error) {
11 return { ok: false, error: error instanceof Error ? error.message : String(error) };
12 }
13}

This file's history is long; its oldest lines are credited to the oldest commit read.