talent-plan/tinysql

parser/model/ddl.go: Job.String may cause nil error which stops debugger

divanodestiny opened this issue · 0 comments

In parser/model/ddl.go, line 273:

// String implements fmt.Stringer interface.
func (job *Job) String() string {
	rowCount := job.GetRowCount()
	return fmt.Sprintf("ID:%d, Type:%s, State:%s, SchemaState:%s, SchemaID:%d, TableID:%d, RowCount:%d, ArgLen:%d, start time: %v, Err:%v, ErrCount:%d, SnapshotVersion:%v",
		job.ID, job.Type, job.State, job.SchemaState, job.SchemaID, job.TableID, rowCount, len(job.Args), TSConvert2Time(job.StartTS), job.Error, job.ErrorCount, job.SnapshotVer)
}

job.Errormay be nil, which will cause nil error when fmt package call Error() define in parse/terror.go line 217 and stop the debugger.
So i think it's needed to check whether job.Error is nil in func job.String, or check whether e is nil in func Error.Error