Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > FileError

FileError class​

An Error subclass that should be thrown to report an unexpected state that specifically references a location in a file.

Signature:

export declare class FileError extends Error 

Extends: Error

Remarks​

The file path provided to the FileError constructor is expected to exist on disk. FileError should not be used for reporting errors that are not in reference to an existing file.

Constructors​

Constructor

Modifiers

Description

(constructor)(message, options)

Constructs a new instance of the FileError class.

Properties​

Property

Modifiers

Type

Description

absolutePath

readonly

string

The absolute path to the file that contains the error.

column

readonly

number | undefined

The column number of the error in the target file. Minimum value is 1.

line

readonly

number | undefined

The line number of the error in the target file. Minimum value is 1.

projectFolder

readonly

string

The root folder for the project that the error is in relation to.

Methods​

Method

Modifiers

Description

[Symbol.hasInstance](instance)

static

getFormattedErrorMessage(options)

Get the formatted error message.

getProblemMatcher(options)

static

Get the problem matcher pattern for parsing error messages.

toString()

Get the Unix-formatted the error message.