All exceptions are now handled in database migration

A different kind of exception was being raised, which caused the errors. Any kind of exceptions are now handled.