define source retry decisions
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package playback
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"mxl-player/internal/source"
|
||||
)
|
||||
|
||||
func shouldRetrySourceError(err error) bool {
|
||||
if errors.Is(err, context.Canceled) {
|
||||
return false
|
||||
}
|
||||
|
||||
switch source.KindOf(err) {
|
||||
case source.ErrorKindInvalidConfig:
|
||||
return false
|
||||
case source.ErrorKindTemporary,
|
||||
source.ErrorKindUnavailable,
|
||||
source.ErrorKindUnknown:
|
||||
return true
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user