add error stack for internal error printing

This commit is contained in:
John Guo
2022-01-28 14:51:49 +08:00
parent 1a000396e2
commit 04eb654133
55 changed files with 175 additions and 240 deletions

View File

@ -317,7 +317,7 @@ func (c *Core) RowsToResult(ctx context.Context, rows *sql.Rows) (Result, error)
}
defer func() {
if err := rows.Close(); err != nil {
intlog.Error(ctx, err)
intlog.Errorf(ctx, `%+v`, err)
}
}()
if !rows.Next() {

View File

@ -49,7 +49,7 @@ func (m *Model) checkAndRemoveCache() {
ctx := m.GetCtx()
_, err := m.db.GetCache().Remove(ctx, m.cacheOption.Name)
if err != nil {
intlog.Error(ctx, err)
intlog.Errorf(ctx, `%+v`, err)
}
}
}

View File

@ -536,7 +536,7 @@ func (m *Model) doGetAllBySql(sql string, args ...interface{}) (result Result, e
if cacheKey != "" && err == nil {
if m.cacheOption.Duration < 0 {
if _, err := cacheObj.Remove(ctx, cacheKey); err != nil {
intlog.Error(m.GetCtx(), err)
intlog.Errorf(m.GetCtx(), `%+v`, err)
}
} else {
// In case of Cache Penetration.
@ -544,7 +544,7 @@ func (m *Model) doGetAllBySql(sql string, args ...interface{}) (result Result, e
result = Result{}
}
if err := cacheObj.Set(ctx, cacheKey, result, m.cacheOption.Duration); err != nil {
intlog.Error(m.GetCtx(), err)
intlog.Errorf(m.GetCtx(), `%+v`, err)
}
}
}