diff --git a/src/main/integrations/sentry-minidump/minidump-loader.ts b/src/main/integrations/sentry-minidump/minidump-loader.ts index 2c9a968d..30e4d1b2 100644 --- a/src/main/integrations/sentry-minidump/minidump-loader.ts +++ b/src/main/integrations/sentry-minidump/minidump-loader.ts @@ -86,6 +86,14 @@ async function deleteCrashpadMetadataFile(crashesDirectory: string, waitMs: numb } } +async function readDirAsyncIfExists(path: string): Promise { + try { + return await readDirAsync(path); + } catch (_) { + return []; + } +} + function crashpadMinidumpLoader(): MinidumpLoader { const crashesDirectory: string = getCrashesDirectory(); const crashpadSubDirectory = process.platform === 'win32' ? 'reports' : 'completed'; @@ -96,7 +104,7 @@ function crashpadMinidumpLoader(): MinidumpLoader { const dumpDirectory = join(crashesDirectory, crashpadSubDirectory); const pendingDirectory = join(crashesDirectory, 'pending'); - return (await readDirAsync(dumpDirectory)) + return (await readDirAsyncIfExists(dumpDirectory)) .filter((file) => file.endsWith('.dmp')) .map((file) => { const path = join(dumpDirectory, file); @@ -107,7 +115,7 @@ function crashpadMinidumpLoader(): MinidumpLoader { }; }) .concat( - (await readDirAsync(pendingDirectory)) + (await readDirAsyncIfExists(pendingDirectory)) .filter((file) => file.endsWith('.dmp')) .map((file) => { const path = join(pendingDirectory, file); diff --git a/test/e2e/test-apps/native-sentry/renderer-force-crash/event.json b/test/e2e/test-apps/native-sentry/renderer-force-crash/event.json index cfa675c7..a760d30a 100644 --- a/test/e2e/test-apps/native-sentry/renderer-force-crash/event.json +++ b/test/e2e/test-apps/native-sentry/renderer-force-crash/event.json @@ -51,12 +51,6 @@ "runtime": { "name": "Electron", "version": "{{version}}" - }, - "electron": { - "crashed_url": "unknown", - "details": { - "reason": "killed" - } } }, "release": "native-sentry-renderer-force-crash@1.0.0", @@ -71,8 +65,7 @@ "event.environment": "native", "event.origin": "electron", "event.process": "renderer", - "event_type": "native", - "exit.reason": "killed" + "event_type": "native" } }, "attachments": [