I recommend reviewing this with whitespace changes disabled.
If a database migration fails, we want to do two things:
1. Check if it failed due to database corruption. If so, flag the
database as corrupted to enable recovery.
2. Crash.
We were only doing the second part because each individual migration
would crash instead of throwing the error.
The logic was effectively this:
do {
for migration in migrations {
do {
try migration.run()
} catch {
crash()
}
}
} catch {
// This `catch` would never happen because a failed migration
// would crash, not throw.
flagDatabaseCorruptionIfNecessary(error)
crash()
}
Now it's this:
do {
for migration in migrations {
try migration.run()
}
} catch {
flagDatabaseCorruptionIfNecessary(error)
crash()
}
See
|
||
|---|---|---|
| .. | ||
| Experience Upgrades | ||
| Jobs | ||
| protobuf | ||
| Resources | ||
| src | ||
| tests | ||
| .clang-format | ||
| .gitignore | ||
| .travis.yml | ||
| SignalServiceKit-Prefix.pch | ||
| SignalServiceKit.h | ||