postgres: Preserve Unlock error when outer err isn't nil

This commit is contained in:
Tomás Senart 2019-01-12 11:26:31 +01:00
parent 15713e64cb
commit 09a1959309
No known key found for this signature in database
GPG Key ID: 424ABFF08108D421
1 changed files with 2 additions and 0 deletions

View File

@ -340,6 +340,8 @@ func (p *Postgres) ensureVersionTable() (err error) {
defer func() {
if e := p.Unlock(); err == nil {
err = e
} else if e != nil {
err = &database.Error{OrigErr: err, Err: e.Error()}
}
}()