Fix undefined stack on some IPC errors (#624)

This commit is contained in:
Cooldude2606 authored and GitHub committed 2024-05-18 14:56:37 +01:00
1 parent c8e54cd563
commit 201209efb3
1 file changed
+2 -2
+2 -2
View File
@@ -564,8 +564,8 @@ export class FactorioServer extends events.EventEmitter {
// TODO at the moment this is just a helper function, it has the potential for schema checking
handle<Event>(eventName: string, handler: (event: Event) => Promise<void>) {
this.on(`ipc-${eventName}`, (event) => handler(event).catch(err => {
this._logger.error(`Error handling ipc event:\n${err.stack}`);
this.on(`ipc-${eventName}`, (event) => handler(event).catch((err: Error) => {
this._logger.error(`Error handling ipc event:\n${err.stack ?? err.message}`);
}));
}