Musickit error handling

This commit is contained in:
Core 2022-09-22 23:45:42 +01:00
parent 71496052df
commit dcc82aa72e
No known key found for this signature in database
GPG key ID: 2AB8327FBA02D1C0
2 changed files with 15 additions and 0 deletions

View file

@ -229,6 +229,7 @@
"home.followedArtists": "Followed Artists", "home.followedArtists": "Followed Artists",
"error.appleMusicSubRequired": "Apple Music requires a subscription.", "error.appleMusicSubRequired": "Apple Music requires a subscription.",
"error.connectionError": "There was a problem connecting to Apple Music.", "error.connectionError": "There was a problem connecting to Apple Music.",
"error.musickitError": "MusicKit Encountered an Error: ",
"error.noResults": "No Results.", "error.noResults": "No Results.",
"error.noResults.description": "Try a new search.", "error.noResults.description": "Try a new search.",
"podcast.followOnCider": "Follow On Cider", "podcast.followOnCider": "Follow On Cider",

View file

@ -305,6 +305,20 @@ const app = new Vue({
app.cfg.musickit["stored-attributes"][attr] = val; app.cfg.musickit["stored-attributes"][attr] = val;
}); });
} }
const ERROR_CODES = ["drmUnsupported", "mediaPlaybackError"];
/* MusicKit.Events */
ERROR_CODES.forEach((code) => {
MusicKit.getInstance().addEventListener(MusicKit.Events[code], (e) => {
console.error(`[MusicKit] MusicKit Error ${code}`);
console.error({ e: e });
app.notyf.open({
duration: 20000,
type: "error",
className: "notyf-info",
message: `<small>${app.getLz("error.musickitError")} \n</small><code>${code.toUpperCase()}</code>`,
});
});
});
}, },
async oobeInit() { async oobeInit() {
this.appMode = "oobe"; this.appMode = "oobe";