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

ConstructorModifiersDescription
(constructor)(message, options)Constructs a new instance of the FileError class.

Properties

PropertyModifiersTypeDescription
absolutePathreadonlystringThe absolute path to the file that contains the error.
columnreadonlynumber | undefinedThe column number of the error in the target file. Minimum value is 1.
linereadonlynumber | undefinedThe line number of the error in the target file. Minimum value is 1.
projectFolderreadonlystringThe root folder for the project that the error is in relation to.

Methods

MethodModifiersDescription
[Symbol.hasInstance](instance)static
getFormattedErrorMessage(options)Get the formatted error message.
toString()Get the Unix-formatted the error message.