try to make playback index out of range log more useful

This commit is contained in:
Drew Weymouth
2025-11-11 08:36:34 -08:00
parent 8b73765a7d
commit 7266030e43
+3 -2
View File
@@ -3,6 +3,7 @@ package backend
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"log" "log"
"math/rand" "math/rand"
"time" "time"
@@ -223,8 +224,8 @@ func (p *playbackEngine) PlayTrackAt(idx int) error {
} }
func (p *playbackEngine) playTrackAt(idx int, startTime float64) error { func (p *playbackEngine) playTrackAt(idx int, startTime float64) error {
if idx < 0 || idx >= len(p.playQueue) { if l := len(p.playQueue); idx < 0 || idx >= l {
return errors.New("track index out of range") return fmt.Errorf("track index (%d) out of range (0-%d)", idx, l)
} }
// scrobble current track if needed // scrobble current track if needed
p.checkScrobble() p.checkScrobble()