Access invalid option from the `InvalidFilter` instance
Background
With UI#228 UI team would like to introduce also hints for invalid filter options, see example in screenshot:
In order to achieve that, would be great to make first matched invalid option
be available from InvalidFilter
object instance.
What to change
Make invalid filter option
accessible from InvalidFilter
instance, i.e.:
const filter = Filter.fromText("@@||example.com^$foo");
if (filter instanceof InvalidFilter && filter.reason === "filter_unknown_option")
{
console.log(filter.option); // foo
}
Testing
Testing this is covered by the unit tests.
To test this manually, try to create a filter with an unknown option with Filter.fromText()
, and it will return an invalid filter, and the option
property will be set to that unknown option.