mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 09:12:09 +08:00
修改错误处理方式
This commit is contained in:
parent
de15a3b2ae
commit
9eb7d5a4e3
@ -183,13 +183,13 @@ export const connect = (urlInfo: LX.Sync.UrlInfo, keyInfo: LX.Sync.KeyInfo) => {
|
||||
},
|
||||
onError(error, path, groupName) {
|
||||
const name = groupName ?? ''
|
||||
log.error(`sync call ${name} ${path.join('.')} error:`, error)
|
||||
if (groupName == null) return
|
||||
client?.close(SYNC_CLOSE_CODE.failed)
|
||||
sendSyncStatus({
|
||||
status: false,
|
||||
message: error.message,
|
||||
})
|
||||
log.r_error(`sync call ${name} ${path.join('.')} error:`, error)
|
||||
// if (groupName == null) return
|
||||
// client?.close(SYNC_CLOSE_CODE.failed)
|
||||
// sendSyncStatus({
|
||||
// status: false,
|
||||
// message: error.message,
|
||||
// })
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { SYNC_CLOSE_CODE } from '@/plugins/sync/constants'
|
||||
import { registerDislikeActionEvent } from '../../../dislikeEvent'
|
||||
|
||||
let unregisterLocalListAction: (() => void) | null
|
||||
@ -11,7 +12,12 @@ export const registerEvent = (socket: LX.Sync.Socket) => {
|
||||
unregisterEvent()
|
||||
unregisterLocalListAction = registerDislikeActionEvent((action) => {
|
||||
if (!socket.moduleReadys?.dislike) return
|
||||
void socket.remoteQueueDislike.onDislikeSyncAction(action)
|
||||
void socket.remoteQueueDislike.onDislikeSyncAction(action).catch(err => {
|
||||
// TODO send status
|
||||
socket.moduleReadys.dislike = false
|
||||
socket.close(SYNC_CLOSE_CODE.failed)
|
||||
console.log(err.message)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { SYNC_CLOSE_CODE } from '@/plugins/sync/constants'
|
||||
import { registerListActionEvent } from '../../../listEvent'
|
||||
|
||||
let unregisterLocalListAction: (() => void) | null
|
||||
@ -11,7 +12,12 @@ export const registerEvent = (socket: LX.Sync.Socket) => {
|
||||
unregisterEvent()
|
||||
unregisterLocalListAction = registerListActionEvent((action) => {
|
||||
if (!socket.moduleReadys?.list) return
|
||||
void socket.remoteQueueList.onListSyncAction(action)
|
||||
void socket.remoteQueueList.onListSyncAction(action).catch(err => {
|
||||
// TODO send status
|
||||
socket.moduleReadys.list = false
|
||||
socket.close(SYNC_CLOSE_CODE.failed)
|
||||
console.log(err.message)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user