mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(resp): keep the not-applied flag through redisStore under yaegi
Yaegi drops the flag when fmt.Errorf wraps the error, and it has no errors.As. respNotApplied now checks the top-level type only. The redisStore wrapper marks its own error when the pipeline error is marked.
This commit is contained in:
@@ -357,19 +357,11 @@ func markNotApplied(err error, wrote bool) error {
|
||||
}
|
||||
|
||||
// respNotApplied reports whether err says the failed call never wrote its request.
|
||||
// It walks Unwrap by hand because errors.As is unsupported under yaegi.
|
||||
// It checks the top-level type only: under yaegi a fmt.Errorf %w wrapper loses the marker, and errors.As is
|
||||
// unsupported, so each wrapper that must keep it (redisStore) re-marks its own error.
|
||||
func respNotApplied(err error) bool {
|
||||
for err != nil {
|
||||
if _, ok := err.(*notAppliedError); ok {
|
||||
return true
|
||||
}
|
||||
u, ok := err.(interface{ Unwrap() error })
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
err = u.Unwrap()
|
||||
}
|
||||
return false
|
||||
_, ok := err.(*notAppliedError)
|
||||
return ok
|
||||
}
|
||||
|
||||
// pipelineMutatingCommands names every RESP command this client ever sends
|
||||
|
||||
Reference in New Issue
Block a user