better handling of query execution error cases