26 lines
472 B
Go
26 lines
472 B
Go
package mxladapter
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"mxl-player/internal/source"
|
|
)
|
|
|
|
// ShouldRetry reports whether an MXL source error should start another attempt.
|
|
func ShouldRetry(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
|
|
}
|
|
}
|