mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +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",
|
||||
"version": "4.3.8",
|
||||
"version": "4.3.9",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
"main": "build/main.js",
|
||||
|
|
|
|||
|
|
@ -141,3 +141,20 @@ ipcRenderer.on('port', (e) => {
|
|||
}
|
||||
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