try to make playback index out of range log more useful
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user