From ab1832b9a5db1c1ad60e000e89ac0d7cf99dc973 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Fri, 7 Aug 2015 16:35:48 +0800 Subject: [PATCH] Handle children db's Error in callbacks --- scope.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scope.go b/scope.go index 104a3728..75b524a0 100644 --- a/scope.go +++ b/scope.go @@ -205,7 +205,9 @@ func (scope *Scope) CallMethod(name string, checkError bool) { case func(s *Scope): f(scope) case func(s *DB): - f(scope.NewDB()) + newDB := scope.NewDB() + f(newDB) + scope.Err(newDB.Error) case func() error: scope.Err(f()) case func(s *Scope) error: