New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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"]

@ghost ghost assigned doug-martin Nov 8, 2013

doug-martin added a commit to doug-martin/nools that referenced this issue Nov 8, 2013

v0.2.1
* Added support for js expression in the `from` node addressing issue [#86](noolsjs#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](noolsjs#85)
* Fixed issue with `from` node where an undefined property would be tested. [#89](noolsjs#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.

@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