Constructor
new CompilerError(code, …args)
Creates an instance of CompilerError.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
code |
string | The AvenxErrorCode identifier. |
|
args |
any |
<repeatable> |
Arguments to format within the template message, optionally ending with a location options object. |
Extends
Classes
Members
code :string
The unique framework error code.
Type:
- string
- Overrides:
- Source:
name :string
Custom name identifier for compiler errors.
Type:
- string
- Overrides:
- Source:
Methods
setLocation(loc) → {CompilerError}
Attaches source location information and generates a code frame with carets (^).
Parameters:
| Name | Type | Description |
|---|---|---|
loc |
object | Location options object containing { line, column, source, filename, index, length }. |
Returns:
Returns this error instance for chaining.
- Type
- CompilerError
(static) formatCodeFrame(source, line, column, optionsopt) → {string}
Helper static method to format code frames.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
source |
string | ||
line |
number | ||
column |
number | ||
options |
object |
<optional> |
Returns:
- Type
- string
(static) getLineAndColumn(source, index) → {Object}
Helper static method to compute line and column coordinates.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
string | |
index |
number |
Returns:
- Type
- Object