Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't 500 if search attribute is invalid
In the case where a user, when providing a search, provides an attribute constraint (-a flag) that is invalid, we currently throw a 500. An invalid attribute constraint most commonly is specifying a nested hash using dot-notation when one or more values in that constraint are, in fact, not a hash. This change prevents the system from throwing a 500 and presents the user with a more correct result, that there is no value for that attribute (because it doesn't exist). For example, `knife search node "*:*" -a uptime.seconds` is invalid because the key `'uptime'` does exist but it is a string, not a hash. Thus, ej attempts to fetch the key `'seconds'` from that string, throwing an error within ej for an invalid function clause. With this change, the search will return just fine but show that there is no value for `uptime.seconds`. Signed-off-by: Tom Duffield <[email protected]>
- Loading branch information