Commit 95579e39 authored by Andreas Heimann's avatar Andreas Heimann

added error handling

parent cc3e18b9
...@@ -20,7 +20,12 @@ function SongDetailLoad(songId) { ...@@ -20,7 +20,12 @@ function SongDetailLoad(songId) {
DOMSongDetail.classList.remove("active"); DOMSongDetail.classList.remove("active");
DOMSongDetailActions.classList.remove("active"); DOMSongDetailActions.classList.remove("active");
api.getSongDetail(songId).then(function(songData) { api.getSongDetail(songId).then(function(apiResponse) {
let songData = apiResponse.data;
if(apiResponse.status == 404) {
NavigateToSection(6);
} else {
DOMSongDetail.classList.add("active"); DOMSongDetail.classList.add("active");
DOMSongDetailActions.classList.add("active"); DOMSongDetailActions.classList.add("active");
...@@ -44,9 +49,13 @@ function SongDetailLoad(songId) { ...@@ -44,9 +49,13 @@ function SongDetailLoad(songId) {
DOMSongTags.appendChild(newTag); DOMSongTags.appendChild(newTag);
} }
}); });
}
currentSongId = songId; currentSongId = songId;
currentSongData = songData; currentSongData = songData;
}).catch(function(error) {
console.error(error);
NavigateToSection(5);
}); });
} }
......
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