aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/DashSession/DashSessionAgent.ts6
-rw-r--r--src/server/DashSession/Session/agents/monitor.ts4
-rw-r--r--src/server/DashSession/Session/agents/server_worker.ts10
3 files changed, 14 insertions, 6 deletions
diff --git a/src/server/DashSession/DashSessionAgent.ts b/src/server/DashSession/DashSessionAgent.ts
index 8279c97ef..a094b3781 100644
--- a/src/server/DashSession/DashSessionAgent.ts
+++ b/src/server/DashSession/DashSessionAgent.ts
@@ -10,7 +10,7 @@ import * as Archiver from "archiver";
import { resolve } from "path";
import rimraf = require("rimraf");
import { AppliedSessionAgent, ExitHandler } from "./Session/agents/applied_session_agent";
-import { ServerWorker } from "./Session/agents/server_worker";
+import { ServerWorker, DeconstructedError } from "./Session/agents/server_worker";
import { Monitor } from "./Session/agents/monitor";
import { MessageHandler } from "./Session/agents/promisified_ipc_manager";
@@ -70,7 +70,7 @@ export class DashSessionAgent extends AppliedSessionAgent {
* Prepares the body of the email with information regarding a crash event.
*/
private _crashInstructions: string | undefined;
- private generateCrashInstructions({ name, message, stack }: Error): string {
+ private generateCrashInstructions({ name, message, stack }: DeconstructedError): string {
if (!this._crashInstructions) {
this._crashInstructions = readFileSync(resolve(__dirname, "./templates/crash_instructions.txt"), { encoding: "utf8" });
}
@@ -109,7 +109,7 @@ export class DashSessionAgent extends AppliedSessionAgent {
/**
* This sends an email with the generated crash report.
*/
- private dispatchCrashReport: MessageHandler<{ error: Error }> = async ({ error: crashCause }) => {
+ private dispatchCrashReport: MessageHandler<{ error: DeconstructedError }> = async ({ error: crashCause }) => {
const { mainLog } = this.sessionMonitor;
const { notificationRecipient } = DashSessionAgent;
const error = await Email.dispatch({
diff --git a/src/server/DashSession/Session/agents/monitor.ts b/src/server/DashSession/Session/agents/monitor.ts
index 044a841ae..1bbbae0a9 100644
--- a/src/server/DashSession/Session/agents/monitor.ts
+++ b/src/server/DashSession/Session/agents/monitor.ts
@@ -9,7 +9,7 @@ import { validate, ValidationError } from "jsonschema";
import { Utilities } from "../utilities/utilities";
import { readFileSync } from "fs";
import IPCMessageReceiver from "./process_message_router";
-import { ServerWorker } from "./server_worker";
+import { ServerWorker, DeconstructedError } from "./server_worker";
/**
* Validates and reads the configuration file, accordingly builds a child process factory
@@ -90,7 +90,7 @@ export class Monitor extends IPCMessageReceiver {
}
public readonly coreHooks = Object.freeze({
- onCrashDetected: (listener: MessageHandler<{ error: Error }>) => this.on(Monitor.IntrinsicEvents.CrashDetected, listener),
+ onCrashDetected: (listener: MessageHandler<{ error: DeconstructedError }>) => this.on(Monitor.IntrinsicEvents.CrashDetected, listener),
onServerRunning: (listener: MessageHandler<{ isFirstTime: boolean }>) => this.on(Monitor.IntrinsicEvents.ServerRunning, listener)
});
diff --git a/src/server/DashSession/Session/agents/server_worker.ts b/src/server/DashSession/Session/agents/server_worker.ts
index 976d27226..e3ec4e1c6 100644
--- a/src/server/DashSession/Session/agents/server_worker.ts
+++ b/src/server/DashSession/Session/agents/server_worker.ts
@@ -112,7 +112,9 @@ export class ServerWorker extends IPCMessageReceiver {
private proactiveUnplannedExit = async (error: Error): Promise<void> => {
this.shouldServerBeResponsive = false;
// communicates via IPC to the master thread that it should dispatch a crash notification email
- this.emit(Monitor.IntrinsicEvents.CrashDetected, { error });
+ const { name, message, stack } = error;
+ const deconstructed_error: DeconstructedError = { name, message, stack };
+ this.emit(Monitor.IntrinsicEvents.CrashDetected, { error: deconstructed_error });
await this.executeExitHandlers(error);
// notify master thread (which will log update in the console) of crash event via IPC
this.lifecycleNotification(red(`crash event detected @ ${new Date().toUTCString()}`));
@@ -157,4 +159,10 @@ export class ServerWorker extends IPCMessageReceiver {
this.pollServer();
}
+}
+
+export interface DeconstructedError {
+ name: string;
+ message: string;
+ stack: string | undefined;
} \ No newline at end of file