INNER CODE UNIT · TypeScript

readOverrides

runvendo/vendo · packages/vendo/src/actions/sync/index.ts:67

async function readOverrides(file: string): Promise<OverridesFile | null> {
  let raw: string;
  try {
    raw = await fs.readFile(file, "utf8");
  } catch (error) {
    if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
    throw error;
  }
  try {
    return overridesFileSchema.parse(JSON.parse(raw));
  } catch (error) {
    const detail = error && typeof error === "object" && "issues" in error
      ? { file, issues: (error as { issues: unknown }).issues }
      : { file, error: error instanceof Error ? error.message : String(error) };
    throw new VendoError("validation", `malformed overrides file: ${file}`, detail);
  }
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…