Catch preupgrade exception

Backport of 1710cc14f63d2a8197ed340368f1f7c7c3193ed1 from master