Commit dc007e2f authored by Mike Jones's avatar Mike Jones 馃尪

Prettify error, fix tags and similar artists if empty

parent 2c818f8c
...@@ -12,6 +12,10 @@ func (f *Fn) ArtistInfo(artist string, nickname string) string { ...@@ -12,6 +12,10 @@ func (f *Fn) ArtistInfo(artist string, nickname string) string {
artistInfo, err := f.getArtistInfo(artist) artistInfo, err := f.getArtistInfo(artist)
if err != nil { if err != nil {
if strings.HasPrefix(err.Error(), "LastfmError[6]") {
return "The artist you supplied could not be found"
}
return fmtError(err) return fmtError(err)
} }
...@@ -25,7 +29,7 @@ func (f *Fn) GetArtistTags(artist string, nickname string) string { ...@@ -25,7 +29,7 @@ func (f *Fn) GetArtistTags(artist string, nickname string) string {
res, err := f.getArtistInfo(artist) res, err := f.getArtistInfo(artist)
if err == nil { if err == nil && len(res.Tags) > 0 {
tags = fmtArtistTags(res) tags = fmtArtistTags(res)
} }
...@@ -87,5 +91,9 @@ func fmtArtistSimilar(artist lastfm.ArtistGetInfo) string { ...@@ -87,5 +91,9 @@ func fmtArtistSimilar(artist lastfm.ArtistGetInfo) string {
s = append(s, artist.Similars[i].Name) s = append(s, artist.Similars[i].Name)
} }
return strings.Join(s, ", ") if len(s) > 0 {
return strings.Join(s, ", ")
}
return "none"
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment