validate query prior to execution, returning error message if necessary

Addresses #8 and #9