From 7e1c830ef67ff3660aa07d07053bb9714327886b Mon Sep 17 00:00:00 2001 From: Daniel Griesser Date: Fri, 24 Jul 2020 09:39:53 +0200 Subject: [PATCH] fix: Rate limit status check --- example/sentry.js | 3 ++- src/main/transports/net.ts | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/sentry.js b/example/sentry.js index aeb33d8e..9249ce8c 100644 --- a/example/sentry.js +++ b/example/sentry.js @@ -1,7 +1,8 @@ const { addBreadcrumb, init } = require('@sentry/electron'); init({ - dsn: 'https://37f8a2ee37c0409d8970bc7559c7c7e4@o19635.ingest.sentry.io/277345', + // dsn: 'https://37f8a2ee37c0409d8970bc7559c7c7e4@o19635.ingest.sentry.io/277345', + dsn: 'https://694d40391ed64847bfa90002ec7fbf32@o19635.ingest.sentry.io/277345', // Same project but 1 event / min rate limit debug: true, // useCrashpadMinidumpUploader: true, // useSentryMinidumpUploader: false, diff --git a/src/main/transports/net.ts b/src/main/transports/net.ts index 1aab6f33..a4ef38e9 100644 --- a/src/main/transports/net.ts +++ b/src/main/transports/net.ts @@ -42,10 +42,9 @@ export class NetTransport extends Transports.BaseTransport { const req = net.request(options as Electron.ClientRequestConstructorOptions); req.on('error', reject); req.on('response', (res: Electron.IncomingMessage) => { + const status = Status.fromHttpCode(res.statusCode); if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { - resolve({ - status: Status.fromHttpCode(res.statusCode), - }); + resolve({ status }); } else { if (status === Status.RateLimit) { const now = Date.now();