Improve error handling and logging in pages migration