split out exception handling logic for moved keys

want to be able to share this logic in the pipeline context later when packing keys and issuing commands in parallel.
agreed about being more verbose and readable. As for moving it into its own function not sure how much code reuse we'd get because I don't think I'll use it in the pipeline context exactly the same way but let's wait and see. If there is some code duplication at that point I'll refactor.