add proper error handling during migrations