- error<TToken, TOptions>(message: string | ((data: Data<TToken, TOptions>, i: number) => string)): Matcher<TToken, TOptions, never>
-
Parameters
-
message: string | ((data: Data<TToken, TOptions>, i: number) => string)
Returns Matcher<TToken, TOptions, never>
Make a Matcher that throws an error if reached.
Use with caution!
Use fail if parser can step back and try a different path.
For error recovery you can try to encode erroneous state in an output value instead.