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 {