class ErrorFactory

Factory class for creating common Nagare errors with consistent formatting

Provides pre-configured error constructors for common failure scenarios. Each method returns a fully-configured NagareError with appropriate error code, message, and recovery suggestions.

Examples

Example 1

import { ErrorFactory } from "@rick/nagare";

// Check git repository state
if (!await isGitRepository()) {
  throw ErrorFactory.gitNotInitialized();
}

// Handle configuration errors
if (!configFound) {
  throw ErrorFactory.configNotFound(searchedPaths);
}

Static Methods

configNotFound(searchedPaths: string[]): NagareError

Create a configuration not found error

Create a file handler not found error

Create a git not initialized error

Create a GitHub CLI not found error

invalidJson(
filePath: string,
parseError: string,
): NagareError

Create an invalid JSON error

Create an uncommitted changes error

versionNotFound(
filePath: string,
searchedPatterns?: string[],
): NagareError

Create a version not found error

See