diff --git a/src/NadekoBot/Modules/Music/Classes/PlaylistFullException.cs b/src/NadekoBot/Modules/Music/Classes/Exceptions.cs similarity index 55% rename from src/NadekoBot/Modules/Music/Classes/PlaylistFullException.cs rename to src/NadekoBot/Modules/Music/Classes/Exceptions.cs index 15541d42..3dd355f9 100644 --- a/src/NadekoBot/Modules/Music/Classes/PlaylistFullException.cs +++ b/src/NadekoBot/Modules/Music/Classes/Exceptions.cs @@ -9,4 +9,12 @@ namespace NadekoBot.Modules.Music.Classes } public PlaylistFullException() : base("Queue is full.") { } } + + class SongNotFoundException : Exception + { + public SongNotFoundException(string message) : base(message) + { + } + public SongNotFoundException() : base("Song is not found.") { } + } } diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index be775ab0..5ba4e180 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -282,9 +282,8 @@ namespace NadekoBot.Modules.Music { await QueueSong(((IGuildUser)umsg.Author), channel, ((IGuildUser)umsg.Author).VoiceChannel, id, true).ConfigureAwait(false); } - catch (PlaylistFullException) - { break; } - catch { } + catch (SongNotFoundException) { } + catch { break; } } await msg.ModifyAsync(m => m.Content = "🎵 `Playlist queue complete.`").ConfigureAwait(false); } @@ -579,6 +578,7 @@ namespace NadekoBot.Modules.Music { await QueueSong(usr, channel, usr.VoiceChannel, item.Query, true, item.ProviderType).ConfigureAwait(false); } + catch (SongNotFoundException) { } catch { break; } } if (msg != null) @@ -794,6 +794,9 @@ namespace NadekoBot.Modules.Music musicPlayer.ThrowIfQueueFull(); resolvedSong = await Song.ResolveSong(query, musicType).ConfigureAwait(false); + if (resolvedSong == null) + throw new SongNotFoundException(); + musicPlayer.AddSong(resolvedSong, queuer.Username); } catch (PlaylistFullException)