[feat] 丰富错误提示信息
This commit is contained in:
parent
42b16293b4
commit
11651ea664
4
scan.go
4
scan.go
@ -141,7 +141,7 @@ func sStructSlice(rows *sql.Rows, dest any) (result RowScan) {
|
||||
if data := *scanArgs[i].(*[]uint8); len(data) > 0 {
|
||||
v := rv.Addr().Interface()
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
panic(fmt.Sprintf("[%s:%s:%s] => %s", lo.Must1(lo.FindKey(keys, i)), rv.Kind(), data, err))
|
||||
panic(fmt.Sprintf("[%s:%s:%s] => %s", lo.Must1(lo.FindKey(keys, i)), rv.Kind(), scanArgs[i], err))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ func sStruct(rows *sql.Rows, dest any) (result RowScan) {
|
||||
if data := *scanArgs[i].(*[]uint8); len(data) > 0 {
|
||||
v := rv.Addr().Interface()
|
||||
if err := json.Unmarshal(data, &v); err != nil {
|
||||
panic(fmt.Sprintf("[%s:%s:%s] => %s", lo.Must1(lo.FindKey(keys, i)), rv.Kind(), data, err))
|
||||
panic(fmt.Sprintf("[%s:%s:%s] => %s", lo.Must1(lo.FindKey(keys, i)), rv.Kind(), scanArgs[i], err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user