Type Definitions
CaseParserType
- Source:
Properties:
Name | Type | Description |
---|---|---|
map |
boolean | Whether or not the parser is an |
function |
boolean | Whether or not the parser is a |
A simple object to check what kind of parser it's.
Type:
Condition
- Source:
Type:
ErrorCaseDefinition
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The name of the case. |
|
message |
ErrorCaseDefinition | string | The formatted message or the |
|
condition |
RegExp | string | A |
|
parsers |
Object.<string, ParserLike> |
<nullable> |
A map of reusable parsers. Each parser can be an |
parse |
InstructionListLike |
<nullable> |
A list of parsers the case should use on extracted parameters. Each item of the list
can be either the name of a parser defined on |
useOriginal |
boolean |
<nullable> |
Whether or not the case should use the original message when matched. |
The required properties to create a new ErrorCase
.
Type:
ErrorCaseMessage() → {string}
- Source:
A function that generates a formatted message for an error.
Returns:
- Type
- string
ErrorCaseOptions
- Source:
Properties:
Name | Type | Description |
---|---|---|
CaseParserClass |
Class.<CaseParser> | The class to be used to create a parser. |
FormattedErrorClass |
Class.<FormattedError> | The class to be used to create a custom error after a message is parsed. |
The options to customize how the class behaves.
Type:
Instruction
- Source:
Type:
InstructionFn(value) → {*}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value captured from the error that needs to formatted. |
Returns:
- Type
- *
InstructionListLike
- Source:
Type:
- Array.<(Instruction|Array.<Instruction>)>
ParserLike()
- Source:
ParserrorErrorObject
- Source:
Properties:
Name | Type | Description |
---|---|---|
message |
string | The error message. |
Type:
ParserrorOptions
- Source:
Properties:
Name | Type | Description |
---|---|---|
CaseParserClass |
Class.<CaseParser> | The class that will be used to create parsers. It will also be sent down to every case
that gets created, on its |
ErrorCaseClass |
Class.<ErrorCase> | The class that will be used to create cases. |
FormattedErrorClass |
Class.<FormattedError> | The class that will be used to create formatted errors. It will also be sent down to
every case that gets created,
on its |
ScopeClass |
Class.<Scope> | The class that will be used to create scopes. |
errorContextProperties |
Array.<string> | A list of properties the class will try to find on given errors in order to use as
context information for |
The options to customize how the class behaves.
Type:
ParserrorParseOptions
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
cases |
Array.<string> | A list of specific cases it should validated against. |
|
scopes |
Array.<string> | A list of specific scopes it should use to valdiate the error. |
|
fallback |
string |
<nullable> |
A fallback message in case the error can't be parsed. If not specified, the returned error will maintain the original message. |
The options that can be used to customize how Parserror#parse
works.
Type:
ParserrorWrapper(error, fallbackopt, nullable) → {FormattedError}
- Source:
A pre configured parser to format errors with specific cases and/or scopes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
error |
Error | string | ParserrorErrorObject | The error to parse. |
||
fallback |
string |
<optional> <nullable> |
null
|
A fallback message in case the error can't be parsed. If not specified, the returned error will maintain the original message. |
Returns:
- Type
- FormattedError