Use validator functions to short-circuit queries and return error messages
Fixed issues highlighted by regression tests
Merge pull request #47 from wri/feature/fix-9-8

validate query prior to execution, returning error message if necessary