mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-21 08:01:58 +00:00
feat: log all errors [probably a bad idea]
This commit is contained in:
parent
f93017fba3
commit
d87e864c41
2 changed files with 18 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Miru",
|
"name": "Miru",
|
||||||
"version": "4.3.8",
|
"version": "4.3.9",
|
||||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||||
"main": "build/main.js",
|
"main": "build/main.js",
|
||||||
|
|
|
||||||
|
|
@ -141,3 +141,20 @@ ipcRenderer.on('port', (e) => {
|
||||||
}
|
}
|
||||||
message = e.ports[0].postMessage.bind(e.ports[0])
|
message = e.ports[0].postMessage.bind(e.ports[0])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const excludedErrorMessages = ['WebSocket']
|
||||||
|
|
||||||
|
function dispatchError (e) {
|
||||||
|
if (e instanceof ErrorEvent) return dispatchError(e.error)
|
||||||
|
if (e instanceof PromiseRejectionEvent) return dispatchError(e.reason)
|
||||||
|
for (const exclude of excludedErrorMessages) {
|
||||||
|
if (e.message?.startsWith(exclude)) return
|
||||||
|
}
|
||||||
|
client?.dispatch('error', e)
|
||||||
|
}
|
||||||
|
|
||||||
|
process.on('uncaughtException', dispatchError)
|
||||||
|
|
||||||
|
window.addEventListener('error', dispatchError)
|
||||||
|
|
||||||
|
window.addEventListener('unhandledrejection', dispatchError)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue