1
0

In playlist load() add an error message.

This commit is contained in:
Alexander Andreev 2023-10-05 17:36:02 +04:00
parent e0fa65fbd7
commit f8fd13f8ed
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -4,6 +4,8 @@ import (
"os"
"strings"
"sync"
"github.com/pkg/errors"
)
// 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 {
data, err := os.ReadFile(p.filePath)
if err != nil {
return err
return errors.Wrap(err, "cannot open a playlist file")
}
p.Lock()
p.playlist = strings.Split(string(data), "\n")