Defensive queue access when talking to backend

To return a proper SQLException instead of a RuntimeException.