mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
error codes introduced in HTMLSubtitles
This commit is contained in:
parent
e8a5669798
commit
3f2cee9041
2 changed files with 18 additions and 5 deletions
|
|
@ -76,7 +76,7 @@ function HTMLSubtitles(containerElement) {
|
|||
})
|
||||
.catch(function() {
|
||||
events.emit('error', Object.freeze({
|
||||
code: 70,
|
||||
code: HTMLSubtitles.ERROR.SUBTITLES_FETCH_FAILED,
|
||||
track: track
|
||||
}));
|
||||
})
|
||||
|
|
@ -90,7 +90,7 @@ function HTMLSubtitles(containerElement) {
|
|||
})
|
||||
.catch(function() {
|
||||
events.emit('error', Object.freeze({
|
||||
code: 71,
|
||||
code: HTMLSubtitles.ERROR.SUBTITLES_PARSE_FAILED,
|
||||
track: track
|
||||
}));
|
||||
});
|
||||
|
|
@ -186,6 +186,11 @@ function HTMLSubtitles(containerElement) {
|
|||
Object.freeze(this);
|
||||
};
|
||||
|
||||
HTMLSubtitles.ERROR = Object.freeze({
|
||||
SUBTITLES_FETCH_FAILED: 70,
|
||||
SUBTITLES_PARSE_FAILED: 71
|
||||
});
|
||||
|
||||
Object.freeze(HTMLSubtitles);
|
||||
|
||||
module.exports = HTMLSubtitles;
|
||||
|
|
|
|||
|
|
@ -150,20 +150,24 @@ function YouTubeVideo(containerElement) {
|
|||
events.emit('propChanged', 'subtitleDarkBackground', getSubtitleDarkBackground());
|
||||
}
|
||||
function onSubtitlesError(error) {
|
||||
var code;
|
||||
var message;
|
||||
switch (error.code) {
|
||||
case 70:
|
||||
case HTMLSubtitles.ERROR.SUBTITLES_FETCH_FAILED:
|
||||
code = HTMLSubtitles.ERROR.SUBTITLES_FETCH_FAILED;
|
||||
message = 'Failed to fetch subtitles from ' + error.track.origin;
|
||||
break;
|
||||
case 71:
|
||||
case HTMLSubtitles.ERROR.SUBTITLES_PARSE_FAILED:
|
||||
code = HTMLSubtitles.ERROR.SUBTITLES_PARSE_FAILED;
|
||||
message = 'Failed to parse subtitles from ' + error.track.origin;
|
||||
break;
|
||||
default:
|
||||
code = -1;
|
||||
message = 'Unknown subtitles error';
|
||||
}
|
||||
|
||||
onError({
|
||||
code: error.code,
|
||||
code: code,
|
||||
message: message,
|
||||
critical: false
|
||||
});
|
||||
|
|
@ -535,6 +539,10 @@ function YouTubeVideo(containerElement) {
|
|||
Object.freeze(this);
|
||||
};
|
||||
|
||||
YouTubeVideo.error = Object.freeze({
|
||||
|
||||
});
|
||||
|
||||
YouTubeVideo.manifest = Object.freeze({
|
||||
name: 'YouTubeVideo',
|
||||
embedded: true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue