diff --git a/gorm.go b/gorm.go index b612e1f4..9c4d444f 100644 --- a/gorm.go +++ b/gorm.go @@ -117,7 +117,9 @@ func Open(dialector Dialector, opts ...Option) (db *DB, err error) { return nil, err } defer func(opt Option) { - opt.AfterInitialize(db) + if errr := opt.AfterInitialize(db); errr != nil { + err = errr + } }(opt) } }