Handle exceptions other than ValidationFailed (bnc#900029)

This fixes a crash on undefined method first for nil:NilClass
in the ensure clause.