From 73c6d3e64e4341bfa47d1d2a2bd72f7d20caf149 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Mon, 29 Mar 2021 18:36:01 +0800 Subject: [PATCH] Add AfterInitialize error --- gorm.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) } }