Open History to see the last commit
1import * as NodeOS from "node:os";
2
3// libuv has no name for EDQUOT, so Node reports it as code "UNKNOWN" with the raw errno.
4const EDQUOT_ERRNO = NodeOS.constants.errno.EDQUOT;
5
6// Redirected console output can fail when its log volume is full.
7export function handleStdioError(error: unknown): void {
8 if (typeof error === "object" && error !== null) {
9 if ("code" in error && (error.code === "EPIPE" || error.code === "ENOSPC")) return;
10 if (EDQUOT_ERRNO !== undefined && "errno" in error && error.errno === -EDQUOT_ERRNO) return;
11 }
12 throw error;
13}