exception handling added to query execution

Signed-off-by: Mikolaj Szabo <savingprivateblue@gmail.com>