catch (and eventually log) query exceptions