Handle exceptions on invalid query

* Added try/catch block and called done to nicely return exception to user.