So I am quite familiar with JavaScript -strictly Vanilla JS. I was recently making a radio streaming site which is working quite well.
My issue is the fact that I can not/do not know how to catch an error from the stream URL. I feel like my code is quite cringe as this is all I do:
player.src = stationsData[id].url;
play.play();
I want to be able to catch all/some of the http errors because in case the link has issues, the whole program 'crashes'. I am familiar with async-await but only with JSON and txt files. Kindly help. I am using the audio html tag to play the audio.
<audio src="" class="audio-player" ></audio>