In playlist load() add an error message.
This commit is contained in:
parent
e0fa65fbd7
commit
f8fd13f8ed
@ -4,6 +4,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Playlist holds a list of paths to a song files.
|
// Playlist holds a list of paths to a song files.
|
||||||
@ -46,7 +48,7 @@ func (p *Playlist) Next() (song string) {
|
|||||||
func (p *Playlist) load() error {
|
func (p *Playlist) load() error {
|
||||||
data, err := os.ReadFile(p.filePath)
|
data, err := os.ReadFile(p.filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.Wrap(err, "cannot open a playlist file")
|
||||||
}
|
}
|
||||||
p.Lock()
|
p.Lock()
|
||||||
p.playlist = strings.Split(string(data), "\n")
|
p.playlist = strings.Split(string(data), "\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user