Catch all exceptions for reporting on Schema_130 migration

When migrating all projects configs during Schema_130 migration,
any unexpected exception would not show the name of the impacted
repo, causing a headache for the Gerrit admin that is willing to
migrate.

Make sure the impacted repository and the exception caused are
always displayed so that the Gerrit admin can have an easier
life understanding what happens.

Change-Id: I133c435d9e6d8677964102b26740d55d687764c6
This commit is contained in:
Luca Milanesio
2019-08-13 08:07:13 +01:00
parent c928ec3adc
commit 3aca363032

View File

@@ -25,10 +25,8 @@ import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
import java.io.IOException;
import java.util.SortedSet;
import java.util.TreeSet;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
@@ -66,7 +64,7 @@ public class Schema_130 extends SchemaVersion {
repoUpgraded.add(projectName);
}
cfg.save(serverUser, COMMIT_MSG);
} catch (ConfigInvalidException | IOException ex) {
} catch (Exception ex) {
throw new OrmException("Cannot migrate project " + projectName, ex);
}
}