This commit is contained in:
Henry Jameson 2026-08-04 20:55:55 +03:00
commit 11054bdad7
7 changed files with 17 additions and 21 deletions

View file

@ -122,7 +122,7 @@ const EmojiTab = {
return this.refreshPackList()
} else {
this.displayError(resp.error)
return Promise.reject(resp)
throw new Error(resp)
}
})
.then(() => {
@ -139,7 +139,7 @@ const EmojiTab = {
return this.refreshPackList()
} else {
this.displayError(resp.error)
return Promise.reject(resp)
throw new Error(resp)
}
})
.then(() => {
@ -239,7 +239,7 @@ const EmojiTab = {
return this.refreshPackList()
} else {
this.displayError(resp.error)
return Promise.reject(resp)
throw new Error(resp)
}
})
.then(() => {
@ -259,7 +259,7 @@ const EmojiTab = {
return this.refreshPackList()
} else {
this.displayError(resp.error)
return Promise.reject(resp)
throw new Error(resp)
}
})
.then(() => {
@ -280,7 +280,7 @@ const EmojiTab = {
return this.refreshPackList()
} else {
this.displayError(resp.error)
return Promise.reject(resp)
throw new Error(resp)
}
})
.then(() => {

View file

@ -262,7 +262,7 @@ export default {
.then((resp) => {
if (resp.error !== undefined) {
this.$emit('displayError', resp.error)
return Promise.reject(resp.error)
throw new Error(resp.error)
}
return resp.json()

View file

@ -198,7 +198,7 @@ export const piniaPersistPlugin =
const setState = (state) => {
if (!loadedGuard.loaded) {
console.info('waiting for old state to be loaded...')
return Promise.reject()
throw new Error('Waiting')
} else {
return storage.setItem(key, state)
}

View file

@ -359,11 +359,7 @@ export const getResourcesIndex = async (url, parser = (x) => x) => {
const total = [...custom, ...builtin]
if (total.length === 0) {
return Promise.reject(
new Error(
`Resource at ${url} and ${customUrl} completely unavailable. Panicking`,
),
)
throw new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`)
}
return Promise.resolve(Object.fromEntries(total))
}

View file

@ -29,9 +29,9 @@ function getOrCreateServiceWorker() {
function subscribePush(registration, isEnabled, vapidPublicKey) {
if (!isEnabled)
return Promise.reject(new Error('Web Push is disabled in config'))
throw new Error('Web Push is disabled in config')
if (!vapidPublicKey)
return Promise.reject(new Error('VAPID public key is not found'))
throw new Error('VAPID public key is not found')
const subscribeOptions = {
userVisibleOnly: false,

View file

@ -512,7 +512,7 @@ export const convertTheme2To3 = (data) => {
{ ...newRule, component: 'Tab' },
{ ...newRule, component: 'ScrollbarElement' },
]
if (newRule.state?.indexOf('toggled') >= 0) {
if (newRule.state?.includes('toggled')) {
rules.push({ ...newRule, state: [...newRule.state, 'focused'] })
rules.push({ ...newRule, state: [...newRule.state, 'hover'] })
rules.push({
@ -520,7 +520,7 @@ export const convertTheme2To3 = (data) => {
state: [...newRule.state, 'hover', 'focused'],
})
}
if (newRule.state?.indexOf('hover') >= 0) {
if (newRule.state?.includes('hover')) {
rules.push({ ...newRule, state: [...newRule.state, 'focused'] })
}
return rules

View file

@ -690,11 +690,11 @@ export const init = ({
.map((combination) => ['normal', ...combination])
.filter((combo) => {
// Optimization: filter out some hard-coded combinations that don't make sense
if (combo.indexOf('disabled') >= 0) {
if (combo.includes('disabled')) {
return !(
combo.indexOf('hover') >= 0 ||
combo.indexOf('focused') >= 0 ||
combo.indexOf('pressed') >= 0
combo.includes('hover') ||
combo.includes('focused') ||
combo.includes('pressed')
)
}
return true
@ -711,7 +711,7 @@ export const init = ({
combination.component = component.name
combination.lazy = component.lazy || parent?.lazy
combination.parent = parent
if (!liteMode && combination.state.indexOf('hover') >= 0) {
if (!liteMode && combination.state.includes('hover')) {
combination.lazy = true
}