Import
import {
attachErrorToActiveSpan,
attachErrorToSpan,
cliErrorBoundary,
cliErrorBoundarySync,
createError,
createErrorHandler,
} from "veryfront/errors";
Examples
Define and create a structured framework error
import { defineError } from "veryfront/errors";
const INVALID_WIDGET = defineError({
slug: "invalid-widget",
category: "GENERAL",
title: "Invalid widget",
status: 400,
});
throw INVALID_WIDGET.create({ detail: "The widget id is malformed." });
Exports
Components
| Name | Description | Source |
|---|---|---|
AGENT_ERROR | source | |
AGENT_INTENT_ERROR | source | |
AGENT_NOT_FOUND | source | |
AGENT_TIMEOUT | source | |
API_CLIENT_ERROR | API client request/response errors (replaces VeryfrontAPIError) | source |
API_ERROR | source | |
API_ROUTE_ERROR | source | |
ASSET_OPTIMIZATION_ERROR | source | |
AUTHENTICATION_REQUIRED | source | |
BRANCH_NOT_FOUND | source | |
BUILD_ERROR_CATALOG | source | |
BUILD_FAILED | source | |
BUNDLE_ERROR | source | |
CACHE_ERROR | source | |
CACHE_INVARIANT_VIOLATION | Cache path invariant violations (replaces CacheInvariantError) | source |
CACHE_PATH_MISMATCH | source | |
CIRCUIT_BREAKER_OPEN | source | |
CIRCULAR_DEPENDENCY | source | |
CLIENT_BOUNDARY_VIOLATION | source | |
CLIENT_ONLY_IN_SERVER | source | |
COMPILATION_ERROR | source | |
COMPONENT_ERROR | source | |
CONFIG_ERROR_CATALOG | source | |
CONFIG_INVALID | source | |
CONFIG_NOT_FOUND | source | |
CONFIG_PARSE_ERROR | source | |
CONFIG_TYPE_ERROR | source | |
CONFIG_VALIDATION_ERROR | Schema-level config validation (e.g. Zod schema mismatch at runtime) | source |
CONFIG_VALIDATION_FAILED | Config file validation failures (replaces ConfigValidationError) | source |
CORS_CONFIG_INVALID | source | |
COST_LIMIT_EXCEEDED | source | |
DEPENDENCY_MISSING | source | |
DEPLOYMENT_ERROR | source | |
DEPLOYMENT_ERROR_CATALOG | source | |
DEPLOYMENT_VERIFICATION_TIMEOUT | source | |
DEV_ERROR_CATALOG | source | |
DEV_SERVER_ERROR | source | |
DYNAMIC_ROUTE_ERROR | source | |
ENV_VAR_MISSING | source | |
ENVIRONMENT_NOT_FOUND | source | |
ERROR_CATALOG | source | |
ERROR_OVERLAY_ERROR | source | |
ERROR_REGISTRY | Central registry mapping every error slug to its definition. Assembled from the per-category registry fragments. | source |
ERROR_SOLUTIONS | source | |
FALLBACK_EXHAUSTED | Both primary and fallback operations failed (replaces FallbackExecutionError) | source |
FAST_REFRESH_ERROR | source | |
FILE_NOT_FOUND | source | |
FILE_WATCH_ERROR | source | |
GENERAL_ERROR_CATALOG | source | |
HMR_ERROR | source | |
HYDRATION_MISMATCH | source | |
IMPORT_MAP_INVALID | source | |
IMPORT_RESOLUTION_ERROR | source | |
INITIALIZATION_ERROR | source | |
INPUT_VALIDATION_FAILED | HTTP request input validation failures (replaces ValidationError) | source |
INVALID_ARGUMENT | source | |
INVALID_IMPORT | source | |
INVALID_ROUTE_FILE | source | |
INVALID_USE_CLIENT | source | |
INVALID_USE_SERVER | source | |
LAYOUT_NOT_FOUND | source | |
MDX_COMPILE_ERROR | source | |
MIDDLEWARE_ERROR | source | |
MODULE_ERROR_CATALOG | source | |
MODULE_NOT_FOUND | source | |
NETWORK_ERROR | source | |
NOT_SUPPORTED | source | |
ORCHESTRATION_ERROR | source | |
PAGE_NOT_FOUND | source | |
PERMISSION_DENIED | source | |
PLATFORM_ERROR | source | |
PORT_IN_USE | source | |
PREVIEW_HOSTNAME_TOO_LONG | source | |
PROBLEM_JSON_CONTENT_TYPE | Content-Type header for RFC 9457 responses | source |
PRODUCTION_BUILD_REQUIRED | source | |
PROJECT_SOURCE_EMPTY | source | |
PUSH_RECEIPT_MISSING | source | |
RELEASE_BUILD_TIMEOUT | source | |
RELEASE_MISSING_VERSION | source | |
RELEASE_NOT_FOUND | Production domain resolved but no active release found | source |
RENDER_ERROR | source | |
REQUEST_ERROR | source | |
RESOURCE_NOT_FOUND | source | |
ROUTE_CONFLICT | source | |
ROUTE_ERROR_CATALOG | source | |
ROUTE_HANDLER_INVALID | source | |
ROUTE_PARAMS_ERROR | source | |
RSC_ERROR_CATALOG | source | |
RSC_PAYLOAD_ERROR | source | |
RUNTIME_ERROR_CATALOG | source | |
SCHEDULE_CONFIG_INVALID | Schedule definition validation failures (required fields, cron, concurrencyPolicy, target) | source |
SECURITY_VIOLATION | Path traversal / secure-fs violations (replaces SecurityError) | source |
SEMAPHORE_TIMEOUT | source | |
SERVER_ERROR_CATALOG | source | |
SERVER_ONLY_IN_CLIENT | source | |
SERVER_START_ERROR | source | |
SERVICE_OVERLOADED | source | |
SOURCE_DIGEST_MISMATCH | source | |
SOURCE_MAP_ERROR | source | |
SOURCEMAP_ERROR | source | |
SSG_GENERATION_ERROR | source | |
TIMEOUT_ERROR | source | |
TOKEN_STORAGE_ERROR | Token storage adapter failures (replaces TokenStorageError) | source |
TOOL_ID_CONFLICT | source | |
TRIGGER_CONFIG_INVALID | Trigger ID format and input serialization validation failures | source |
TRIGGER_EXECUTION_FAILED | Trigger target task or workflow failed during local run | source |
TRIGGER_NOT_SUPPORTED | Trigger target type is not supported in the current runtime context | source |
TRIGGER_TARGET_NOT_FOUND | Trigger target (task or workflow) not found during local run | source |
TYPESCRIPT_ERROR | source | |
UNKNOWN_ERROR | source | |
VERSION_MISMATCH | source | |
WEBHOOK_CONFIG_INVALID | Webhook definition validation failures (required fields, target, eventFilter) | source |
Functions
| Name | Description | Source |
|---|---|---|
attachErrorToActiveSpan | Attach error to the currently active span (if any) | source |
attachErrorToSpan | Attach error metadata to an OpenTelemetry span | source |
cliErrorBoundary | CLI error boundary - wraps a handler function and catches errors | source |
cliErrorBoundarySync | Synchronous version of CLI error boundary | source |
createError | source | |
createErrorHandler | Express/Hono-style error handler middleware factory | source |
createErrorResponse | Create an RFC 9457 compliant error Response | source |
createErrorResponseFromDefinition | Create an RFC 9457 error Response from a registered error definition | source |
createErrorScope | Create a scoped error context helper for multiple related operations | source |
createErrorSolution | source | |
createProblemResponse | Create an RFC 9457 error Response from raw parameters | source |
createSimpleError | source | |
defineError | Define an error in the registry | source |
ensureError | Ensure a value is an Error while preserving the established identity contract for ordinary Error instances. | source |
errorToResponse | Convert any error to an RFC 9457 Response | source |
errorToRFC9457Response | Convert any error to an RFC 9457 Response with environment-aware filtering | source |
formatCLIError | Format any error for CLI output | source |
formatErrorLog | Log format for errors (matches the plan’s log format spec) | source |
formatUserError | Format error with plain text (existing behavior) | source |
fromError | Decode legacy Veryfront error data attached by toError(). | source |
getAllSlugs | Get all registered slugs | source |
getErrorBySlug | Get an error definition by slug | source |
getErrorMessage | Extract error message from any error type | source |
getErrorsByCategory | Get all errors in a category | source |
getErrorSolution | source | |
handleErrorWithFallback | source | |
handleErrorWithFallbackSync | source | |
httpErrorBoundary | Wrap a handler with error boundary that catches all errors and converts them to RFC 9457 Problem Details responses. | source |
identifyError | source | |
isVeryfrontError | Check if an error is a VeryfrontError with slug-based identity | source |
logError | Log a VeryfrontError with structured formatting | source |
logErrorWithMessage | Log an error with a custom message prefix | source |
retryWithBackoff | source | |
safeFileRead | Safe file read with logging | source |
safeFileStat | Safe file stat with logging | source |
safeReadDir | Safe directory read with logging | source |
searchErrors | source | |
toError | Convert a VeryfrontErrorData (plain object) to a throwable Error instance. | source |
toError | source | |
toError | source | |
withErrorContext | Execute async operation with error logging and fallback | source |
withErrorContextSync | Execute sync operation with error logging and fallback | source |
wrapErrorHandler | source | |
wrapHandlerWithErrorBoundary | Wrap a complete Handler object with error boundary | source |
wrapUnknownError | Return a detached VeryfrontError, preserving safe identity fields from valid VeryfrontError inputs | source |
wrapWithContext | Wrap an error with additional context | source |
Classes
| Name | Description | Source |
|---|---|---|
VeryfrontError | Veryfront Error class with slug-based error identity | source |
Types
| Name | Description | Source |
|---|---|---|
ConfigContext | source | |
ErrorCatalog | source | |
ErrorCategory | Error categories for domain-based grouping and handling | source |
ErrorContext | source | |
ErrorCreateOptions | Options for creating an error instance | source |
ErrorDefinition | Error definition for the registry | source |
ErrorHandlingOptions | source | |
ErrorLogEntry | source | |
ErrorSlug | source | |
ErrorSolution | source | |
LogLevel | source | |
PartialErrorCatalog | source | |
RegisteredError | Registered error with factory method | source |
RetryWithBackoffOptions | Options for retryWithBackoff. Every attempt value passed to fn and the hooks below is 0-based (first try = 0), including wrapFinalError’s lastAttempt. | source |
RFC9457Response | RFC 9457 Problem Details response shape | source |
UserFriendlyErrorSolution | source | |
VeryfrontErrorData | Discriminated union for serializable error data. | source |
VeryfrontErrorOptions | Options for VeryfrontError constructor | source |
Deep imports
These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.veryfront/errors/general
import { AUTHENTICATION_REQUIRED, FILE_NOT_FOUND, GENERAL_REGISTRY } from "veryfront/errors/general";
Components
| Name | Description | Source |
|---|---|---|
AUTHENTICATION_REQUIRED | source | |
FILE_NOT_FOUND | source | |
GENERAL_REGISTRY | Registry fragment for GENERAL errors (slug → definition). | source |
INITIALIZATION_ERROR | source | |
INPUT_VALIDATION_FAILED | HTTP request input validation failures (replaces ValidationError) | source |
INVALID_ARGUMENT | source | |
NOT_SUPPORTED | source | |
PERMISSION_DENIED | source | |
PROJECT_SOURCE_EMPTY | source | |
RESOURCE_NOT_FOUND | source | |
SECURITY_VIOLATION | Path traversal / secure-fs violations (replaces SecurityError) | source |
TIMEOUT_ERROR | source | |
UNKNOWN_ERROR | source |
veryfront/errors/module
import { CIRCULAR_DEPENDENCY, DEPENDENCY_MISSING, IMPORT_RESOLUTION_ERROR } from "veryfront/errors/module";