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.
I didn't want to make the mock classes a dependency for testing and this seems to work fine. Let me know if you'd like something more robust.