Prevent exception if "from" clause references an undefined property. #89

Closed
atrniv opened this Issue Nov 7, 2013 · 0 comments

Projects

None yet

2 participants

@atrniv
atrniv commented Nov 7, 2013

Currently nools throws an exception if the from clause references an key which does not exist on an object.
I think it would be much more useful if nools simply considers the check condition as false instead of throwing an error.
This could be useful in situation where the object being checked changes structure.

The workaround I use for this situation is to check that the key exists in a condition before the check with the from clause.

Eg:

Ideal scenario : Right now this throws an error if property does not exist

[Item, "foo"]
[Object, "property", "property > 10", "from foo.property"]

Workaround

[Item, "foo", "isDefined('property')"]
[Object, "property", "property > 10", "from foo.property"]
@doug-martin doug-martin was assigned Nov 8, 2013
@doug-martin doug-martin added a commit to doug-martin/nools that referenced this issue Nov 8, 2013
@doug-martin doug-martin v0.2.1
* Added support for js expression in the `from` node addressing issue [#86](C2FO#86)
* Enhanced `JoinReferenceNode` performance in the default assert case where there are no `references` to left or right context.
* Added ability to use `or` and `not` in tandem to check for the non-existence of multiple facts. [#85](C2FO#85)
* Fixed issue with `from` node where an undefined property would be tested. [#89](C2FO#89)
* You can now define a custom resolution strategy.
* Compiling nools files now supports the from modifier.
* Documentation updates
   * Updates about from node support with js values.
   * New documentation about using `or` and `not` constratints together.
   * Updated `or` documentation to include a three constraint example.
86eea5e
@doug-martin doug-martin referenced this issue Nov 8, 2013
Merged

v0.2.1 #90

@doug-martin doug-martin closed this Nov 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment