From d87b8823361d76837a1e4e0f860fed126e2f2d71 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Tue, 29 Dec 2020 17:56:39 +0100 Subject: Exception handling added to PC and AC --- jMusicHub.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jMusicHub.java b/jMusicHub.java index 56bb957..0fe2303 100644 --- a/jMusicHub.java +++ b/jMusicHub.java @@ -805,7 +805,11 @@ public static void listAudioBooksByAuthor(){ listPlaylistsByName(); break; case "PC": //display content of a chosen playlist - contentOfPlaylist(playlists); + try { + contentOfPlaylist(playlists); + } catch (InputMismatchException e) { + System.out.println("You typed something wrong... I'm aborting.."); + } break; case "AD" : // albums sorted by date listAlbumsByDate(); @@ -814,7 +818,11 @@ public static void listAudioBooksByAuthor(){ listAlbumsByGenre(); break; case "AC": //display content of a chosen album - contentOfAlbum(albums); + try { + contentOfAlbum(albums); + } catch (InputMismatchException e) { + System.out.println("You typed something wrong... I'm aborting.."); + } break; case "BA": //display audiobooks sorted by authors listAudioBooksByAuthor(); -- cgit v1.2.3