WIP! A BB-style forum, on the ATmosphere!
We're still working... we'll be back soon when we have something to show off!
node
typescript
hono
htmx
atproto
1/**
2 * Returns true for errors that indicate a programming bug rather than a
3 * runtime failure (network down, DB unavailable, bad user input, etc.).
4 *
5 * These should NOT be caught and swallowed — re-throw them so they surface
6 * clearly during development instead of being silently logged.
7 *
8 * - TypeError: accessing a property on null/undefined, calling a non-function
9 * - ReferenceError: using an undeclared variable
10 * - SyntaxError: malformed JSON.parse in our own code
11 */
12export function isProgrammingError(error: unknown): boolean {
13 return (
14 error instanceof TypeError ||
15 error instanceof ReferenceError ||
16 error instanceof SyntaxError
17 );
18}