mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 09:58:18 -07:00
Use Error instead of literal for promise rejection
This commit is contained in:
parent
cf0d2076b5
commit
c3ad26ea55
@ -79,6 +79,7 @@ module.exports = {
|
||||
'operator-linebreak': ['error', 'before', { overrides: { '?': 'after', ':': 'after', '=': 'after' } }],
|
||||
'padded-blocks': ['error', 'never'],
|
||||
'prefer-const': ['error', { 'destructuring': 'all' }],
|
||||
'prefer-promise-reject-errors': ['warn', { 'allowEmptyReject': true }],
|
||||
'@typescript-eslint/prefer-for-of': ['error'],
|
||||
'@typescript-eslint/prefer-optional-chain': ['error'],
|
||||
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
|
||||
|
@ -366,7 +366,7 @@ export function show(options: Options) {
|
||||
|
||||
resolve(selectedId);
|
||||
} else {
|
||||
reject('ActionSheet closed without resolving');
|
||||
reject(new Error('ActionSheet closed without resolving'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -2496,7 +2496,7 @@ class PlaybackManager {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (!isServerItem(item) || itemHelper.isLocalItem(item)) {
|
||||
return Promise.reject('skip bitrate detection');
|
||||
return Promise.reject(new Error('skip bitrate detection'));
|
||||
}
|
||||
|
||||
return apiClient.getEndpointInfo()
|
||||
@ -2508,7 +2508,7 @@ class PlaybackManager {
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.reject('skip bitrate detection');
|
||||
return Promise.reject(new Error('skip bitrate detection'));
|
||||
});
|
||||
})
|
||||
.catch(() => getSavedMaxStreamingBitrate(apiClient, mediaType));
|
||||
|
@ -389,7 +389,7 @@ class AppRouter {
|
||||
if (firstResult.State === ConnectionState.ServerSignIn) {
|
||||
const url = firstResult.ApiClient.serverAddress() + '/System/Info/Public';
|
||||
fetch(url).then(response => {
|
||||
if (!response.ok) return Promise.reject('fetch failed');
|
||||
if (!response.ok) return Promise.reject(new Error('fetch failed'));
|
||||
return response.json();
|
||||
}).then(data => {
|
||||
if (data !== null && data.StartupWizardCompleted === false) {
|
||||
|
@ -26,7 +26,7 @@ export function waitForEventOnce(emitter, eventType, timeout, rejectEventTypes)
|
||||
let rejectTimeout;
|
||||
if (timeout) {
|
||||
rejectTimeout = setTimeout(() => {
|
||||
reject('Timed out.');
|
||||
reject(new Error('Timed out.'));
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class QueueCore {
|
||||
|
||||
if (!itemIds.length) {
|
||||
if (this.lastPlayQueueUpdate && playQueueUpdate.LastUpdate.getTime() <= this.getLastUpdateTime()) {
|
||||
return Promise.reject('Trying to apply old update');
|
||||
return Promise.reject(new Error('Trying to apply old update'));
|
||||
}
|
||||
|
||||
this.lastPlayQueueUpdate = playQueueUpdate;
|
||||
|
@ -113,7 +113,7 @@ class TimeSync {
|
||||
*/
|
||||
requestPing() {
|
||||
console.warn('SyncPlay TimeSync requestPing: override this method!');
|
||||
return Promise.reject('Not implemented.');
|
||||
return Promise.reject(new Error('Not implemented.'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user