mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-27 12:45:25 +00:00
Move uncaught exception handler to wrapper
Feels more appropriate there to me.
This commit is contained in:
parent
811cf3364a
commit
6bdaada689
@ -18,13 +18,6 @@ import { loadPlugins } from "./plugin"
|
|||||||
import { generateCertificate, hash, humanPath, open } from "./util"
|
import { generateCertificate, hash, humanPath, open } from "./util"
|
||||||
import { ipcMain, wrap } from "./wrapper"
|
import { ipcMain, wrap } from "./wrapper"
|
||||||
|
|
||||||
process.on("uncaughtException", (error) => {
|
|
||||||
logger.error(`Uncaught exception: ${error.message}`)
|
|
||||||
if (typeof error.stack !== "undefined") {
|
|
||||||
logger.error(error.stack)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
let pkg: { version?: string; commit?: string } = {}
|
let pkg: { version?: string; commit?: string } = {}
|
||||||
try {
|
try {
|
||||||
pkg = require("../../package.json")
|
pkg = require("../../package.json")
|
||||||
|
@ -254,6 +254,14 @@ if (!process.stdout.isTTY) {
|
|||||||
process.stdout.on("error", () => ipcMain().exit())
|
process.stdout.on("error", () => ipcMain().exit())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't let uncaught exceptions crash the process.
|
||||||
|
process.on("uncaughtException", (error) => {
|
||||||
|
logger.error(`Uncaught exception: ${error.message}`)
|
||||||
|
if (typeof error.stack !== "undefined") {
|
||||||
|
logger.error(error.stack)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
export const wrap = (fn: () => Promise<void>): void => {
|
export const wrap = (fn: () => Promise<void>): void => {
|
||||||
if (ipcMain().parentPid) {
|
if (ipcMain().parentPid) {
|
||||||
ipcMain()
|
ipcMain()
|
||||||
|
Loading…
Reference in New Issue
Block a user