Wrap idToPath in a try/catch block.