fix: suppress all main node JS error messages (#1460)
This commit is contained in:
parent
be0cecb9c8
commit
18e6656ee7
@ -2,7 +2,6 @@ import { app, BrowserWindow } from 'electron'
|
|||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { setupMenu } from './utils/menu'
|
import { setupMenu } from './utils/menu'
|
||||||
import { createUserSpace } from './utils/path'
|
import { createUserSpace } from './utils/path'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Managers
|
* Managers
|
||||||
**/
|
**/
|
||||||
@ -19,7 +18,7 @@ import { handleAppIPCs } from './handlers/app'
|
|||||||
import { handleAppUpdates } from './handlers/update'
|
import { handleAppUpdates } from './handlers/update'
|
||||||
import { handleFsIPCs } from './handlers/fs'
|
import { handleFsIPCs } from './handlers/fs'
|
||||||
import { migrateExtensions } from './utils/migration'
|
import { migrateExtensions } from './utils/migration'
|
||||||
import { dispose } from './utils/disposable'
|
import { cleanUpAndQuit } from './utils/clean'
|
||||||
|
|
||||||
app
|
app
|
||||||
.whenReady()
|
.whenReady()
|
||||||
@ -89,12 +88,10 @@ function handleIPCs() {
|
|||||||
handleFileMangerIPCs()
|
handleFileMangerIPCs()
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanUpAndQuit() {
|
/*
|
||||||
if (!ModuleManager.instance.cleaningResource) {
|
** Suppress Node error messages
|
||||||
ModuleManager.instance.cleaningResource = true
|
*/
|
||||||
WindowManager.instance.currentWindow?.destroy()
|
process.on('uncaughtException', function (err) {
|
||||||
dispose(ModuleManager.instance.requiredModules)
|
// TODO: Write error to log file in #1447
|
||||||
ModuleManager.instance.clearImportedModules()
|
console.error(err)
|
||||||
app.quit()
|
})
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
14
electron/utils/clean.ts
Normal file
14
electron/utils/clean.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { ModuleManager } from '@janhq/core/node'
|
||||||
|
import { WindowManager } from './../managers/window'
|
||||||
|
import { dispose } from './disposable'
|
||||||
|
import { app } from 'electron'
|
||||||
|
|
||||||
|
export function cleanUpAndQuit() {
|
||||||
|
if (!ModuleManager.instance.cleaningResource) {
|
||||||
|
ModuleManager.instance.cleaningResource = true
|
||||||
|
WindowManager.instance.currentWindow?.destroy()
|
||||||
|
dispose(ModuleManager.instance.requiredModules)
|
||||||
|
ModuleManager.instance.clearImportedModules()
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user