UnparsableCondition enum
What to do with a condition the parser cannot make sense of.
The two cases are an operator it has never heard of, and a field query that mixes operators with plain keys. Both mean the same thing in practice: a rule arrived that this client cannot evaluate.
Values
- fail → const UnparsableCondition
-
Throw a ConditionFormatException naming what was wrong. The default.
Right for rules written in Dart, where an unknown operator is a typo and a silent denial would be a bug nobody finds.
- deny → const UnparsableCondition
-
Parse it into Condition.never, so the rule grants nothing.
Right for rules arriving from a server that may have moved ahead of the client. A single unfamiliar rule then denies its own grant, instead of throwing from wherever fail first meets it.
And where it first meets it is the problem: conditions compile lazily, and a rule checked only against a subject type never compiles them at all — so a rule this client cannot read can pass
can('read', 'Article')and only throw when somebody opens a list.RuleIndex.validateRulesforces the question at a point you choose.Denying rather than ignoring is deliberate: a condition nobody can evaluate must not be read as "no condition".
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
UnparsableCondition> - A constant List of the values in this enum, in order of their declaration.