Catch exception when reading from the queue.