class FSError
extends Error

Structured error types for file-system operations.

Examples

Example 1

import { readTextFile, FSError } from "@anabranch/fs";

const result = await readTextFile("./config.json").run();
if (result.type === "error") {
  const err = result.error;
  if (err instanceof FSError) {
    console.error(`${err.kind}: ${err.path} - ${err.message}`);
  }
}

Constructors

new
FSError(
kind: string,
path: string | URL,
message: string,
)

Properties

readonly
kind: string
readonly
path: string | URL

Usage

import { FSError } from ".";