Class: Z2FViteError
Defined in: packages/vite/src/errors.ts:67
Structured error thrown by the @zod-to-form/vite plugin.
Every error carries a stable code (see Z2FViteErrorCode) and an optional
file location. During vite dev the plugin catches these and reports them via
the dev-server error overlay. During vite build they propagate and abort the
build with the code as a breadcrumb.
Use When
- Catching plugin errors in integration tests:
expect(fn).toThrow(/Z2F_VITE_/)) - Wrapping plugin calls in error handlers that need to branch on specific error codes
Avoid When
- General application error handling — this class is specific to plugin-level failures
Pitfalls
- NEVER compare
error.messageto detect error type — the message format may change. Useerror.code(e.g.error.code === 'Z2F_VITE_SCHEMA_NOT_FOUND') for stable matching
Extends
Error
Constructors
Constructor
new Z2FViteError(
code,message,location?):Z2FViteError
Defined in: packages/vite/src/errors.ts:71
Parameters
code
message
string
location?
Returns
Z2FViteError
Overrides
Error.constructor
Properties
cause?
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es2022.error.d.ts:24
Inherited from
Error.cause
code
readonlycode:Z2FViteErrorCode
Defined in: packages/vite/src/errors.ts:68
location?
readonlyoptionallocation?:Z2FViteErrorLocation
Defined in: packages/vite/src/errors.ts:69
message
message:
string
Defined in: node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
Error.message
name
name:
string
Defined in: node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
Error.name
stack?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@6.0.2/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.stack
stackTraceLimit
staticstackTraceLimit:number
Defined in: node_modules/.pnpm/@types+node@25.6.0/node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
staticcaptureStackTrace(targetObject,constructorOpt?):void
Defined in: packages/vite/src/errors.ts:104
Captures the current V8 call stack and attaches it to targetObject.stack.
Inherited from the built-in Node.js Error class. Documented here so
TypeDoc surfaces it as part of the Z2FViteError API.
Parameters
targetObject
object
The object on which the stack property is set.
constructorOpt?
Function
Optional constructor; frames above it are omitted from the trace.
Returns
void
Overrides
Error.captureStackTrace
isError()
staticisError(error):error is Error
Defined in: packages/vite/src/errors.ts:92
Returns true when error is an instance of Error.
Inherited from the built-in Error class (ES2025). Documented here so
TypeDoc surfaces the complete API for Z2FViteError without consumers
needing to check the global Error reference.
Parameters
error
unknown
The value to test.
Returns
error is Error
true if error is an Error instance; false otherwise.
Overrides
Error.isError
prepareStackTrace()
staticprepareStackTrace(err,stackTraces):unknown
Defined in: packages/vite/src/errors.ts:117
Optional hook called by V8 to format the stack trace string.
Inherited from the built-in Node.js Error class. When set, it replaces V8's
default stack-trace formatter.
Parameters
err
Error
The Error instance whose stack is being formatted.
stackTraces
CallSite[]
The structured stack-trace frames provided by V8.
Returns
unknown
A formatted stack string (or any value; V8 coerces it via .toString()).
Overrides
Error.prepareStackTrace