From f8fd13f8edf494f3da23e7075b3498c72f4ab702 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Thu, 5 Oct 2023 17:36:02 +0400 Subject: [PATCH] In playlist load() add an error message. --- internal/radio/playlist.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/radio/playlist.go b/internal/radio/playlist.go index 5081fd9..fa25aba 100644 --- a/internal/radio/playlist.go +++ b/internal/radio/playlist.go @@ -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")