From 519c2ab44f78a417dfdc957ad30ee0609139b4f4 Mon Sep 17 00:00:00 2001 From: Xuecheng Zhang Date: Tue, 10 Sep 2019 09:49:14 +0800 Subject: [PATCH] checker: keep the original database error in the error message (#276) --- checker/checker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checker/checker.go b/checker/checker.go index a4986e941c..11dedc4c94 100644 --- a/checker/checker.go +++ b/checker/checker.go @@ -126,7 +126,7 @@ func (c *Checker) Init() (err error) { } instance.sourceDB, err = dbutil.OpenDB(*instance.sourceDBinfo) if err != nil { - return terror.WithScope(terror.ErrTaskCheckFailedOpenDB.Generate(instance.cfg.From.User, instance.cfg.From.Host, instance.cfg.From.Port), terror.ScopeUpstream) + return terror.WithScope(terror.ErrTaskCheckFailedOpenDB.Delegate(err, instance.cfg.From.User, instance.cfg.From.Host, instance.cfg.From.Port), terror.ScopeUpstream) } instance.targetDBInfo = &dbutil.DBConfig{ @@ -137,7 +137,7 @@ func (c *Checker) Init() (err error) { } instance.targetDB, err = dbutil.OpenDB(*instance.targetDBInfo) if err != nil { - return terror.WithScope(terror.ErrTaskCheckFailedOpenDB.Generate(instance.cfg.To.User, instance.cfg.To.Host, instance.cfg.To.Port), terror.ScopeDownstream) + return terror.WithScope(terror.ErrTaskCheckFailedOpenDB.Delegate(err, instance.cfg.To.User, instance.cfg.To.Host, instance.cfg.To.Port), terror.ScopeDownstream) } if _, ok := c.checkingItems[config.VersionChecking]; ok {