Skip to main content

Function: formatZ2FViteError()

formatZ2FViteError(error): string

Defined in: packages/vite/src/errors.ts:141

Format a Z2FViteError for inclusion in a Vite error overlay or terminal output. The error's message already includes the code prefix ([Z2F_VITE_...]); this function appends the source location line when error.location.file is set.

Parameters

error

Z2FViteError

The Z2FViteError to format.

Returns

string

A human-readable error string with optional file:line:column location appended.

Example

try { ... } catch (e) {
if (e instanceof Z2FViteError) console.error(formatZ2FViteError(e));
}

Throws

Never — this function is purely a formatter.