From ad53074f1d548297205cd0a6affe333ab2b22e54 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 9 Apr 2021 11:07:14 +0800 Subject: [PATCH] Pass db error to new instance --- gorm.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gorm.go b/gorm.go index 9c4d444f..f1e3745f 100644 --- a/gorm.go +++ b/gorm.go @@ -346,7 +346,7 @@ func (db *DB) DB() (*sql.DB, error) { func (db *DB) getInstance() *DB { if db.clone > 0 { - tx := &DB{Config: db.Config} + tx := &DB{Config: db.Config, Error: db.Error} if db.clone == 1 { // clone with new statement