[feat] 丰富错误提示信息

This commit is contained in:
what 2023-07-31 20:53:24 +08:00
parent 42b16293b4
commit 11651ea664

View File

@ -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))
}
}
}