aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2020-12-29 17:56:39 +0100
committerClyhtsuriva <aimeric@adjutor.xyz>2020-12-29 17:56:39 +0100
commitd87b8823361d76837a1e4e0f860fed126e2f2d71 (patch)
treee1a6f74281813a0a408b377e8af82868b13b34c8
parent3690d6bf3f0da7ab0d60f4502b008c84f4426486 (diff)
Exception handling added to PC and AC
-rw-r--r--jMusicHub.java12
1 files 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();