Skip to main content

Function: formatError()

formatError(parsedErrorData, rootDir?, uniqueTracker?): Promise<string>

Defined in: cliUtils.ts:178

Formats provided error object into readable format including the errored source code fragment with line highlight. Works with runtime and compile errors while trying to show all relevant information that can be extracted from provided object.

Parameters

parsedErrorData

ParsedErrorData

Parsed error data object obtained from parseError function (or provided directly).

rootDir?

string

Optional root directory used to print absolute URLs as relative to the current rootDir.

uniqueTracker?

string[]

Array of error identifiers to track uniques, if the error matches identifier already included in this array, this function returns empty string.

Returns

Promise<string>

Formatted error output.