ignore error `sql: Scan error on column index...`

This commit is contained in:
Jinzhu 2013-12-27 11:19:29 +08:00
parent e2f8d29d7f
commit cc4fcbe557
1 changed files with 16 additions and 9 deletions

View File

@ -46,16 +46,23 @@ func (s *DB) fileWithLineNum() string {
}
func (s *DB) err(err error) error {
if err != nil {
s.Error = err
if s.logMode == 0 {
if err != RecordNotFound {
go fmt.Println(s.fileWithLineNum(), err)
}
} else {
s.warn(err)
}
if err == nil {
return nil
}
if s.logMode == 0 {
if err != RecordNotFound {
go fmt.Println(s.fileWithLineNum(), err)
error_str := err.Error()
if regexp.MustCompile(`^sql: Scan error on column index`).MatchString(error_str) {
return nil
}
}
} else {
s.warn(err)
}
s.Error = err
return err
}