From 115c1dfde953ea8457cc350de075f5ee10d37b33 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Thu, 16 Nov 2017 17:44:54 +0100 Subject: [PATCH 1/4] change onFailure to onError and add correct parameter --- typescript/raven.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index 0c2dec761eca..23bef22ad75b 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -264,7 +264,7 @@ declare module Raven { sentry_key: string; }; onSuccess: () => void; - onFailure: () => void; + onError: (error: Error & { request: XMLHttpRequest }) => void; } interface RavenPlugin { From 1a52f340405547d9c5c974aea897c1fe94ff9bd2 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Fri, 17 Nov 2017 14:45:25 +0100 Subject: [PATCH 2/4] fix callback typings --- typescript/raven.d.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index 23bef22ad75b..74fc7259384d 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -236,13 +236,13 @@ declare module Raven { isSetup(): boolean; /** Specify a function that allows mutation of the data payload right before being sent to Sentry. */ - setDataCallback(data: any, orig?: any): RavenStatic; + setDataCallback(callback: RavenCallback): RavenStatic; /** Specify a callback function that allows you to mutate or filter breadcrumbs when they are captured. */ - setBreadcrumbCallback(data: any, orig?: any): RavenStatic; + setBreadcrumbCallback(callback: RavenCallback): RavenStatic; /** Specify a callback function that allows you to apply your own filters to determine if the message should be sent to Sentry. */ - setShouldSendCallback(data: any, orig?: any): RavenStatic; + setShouldSendCallback(callback: RavenCallback): RavenStatic; /** Show Sentry user feedback dialog */ showReportDialog(options?: Object): void; @@ -255,6 +255,8 @@ declare module Raven { setDSN(dsn: string): void; } + type RavenCallback = (data: any, orig: (data: any) => any) => any | void; + interface RavenTransportOptions { url: string; data: any; From 2261e0c6aee9040c85f063c05326970f1284f3e5 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Fri, 17 Nov 2017 16:06:54 +0100 Subject: [PATCH 3/4] Review feedback --- typescript/raven.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index 74fc7259384d..c2c077d7c4aa 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -265,8 +265,8 @@ declare module Raven { sentry_client: string; sentry_key: string; }; - onSuccess: () => void; - onError: (error: Error & { request: XMLHttpRequest }) => void; + onSuccess(): void; + onError(error: Error & { request?: XMLHttpRequest }): void; } interface RavenPlugin { From 8c58e32a9e6cbcd3efcb531d49a1076148d34346 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Fri, 17 Nov 2017 18:20:47 +0100 Subject: [PATCH 4/4] Additional changes I've found while debugging --- typescript/raven.d.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index c2c077d7c4aa..49a0fa52843f 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -82,6 +82,13 @@ declare module Raven { * A sampling rate to apply to events. A value of 0.0 will send no events, and a value of 1.0 will send all events (default). */ sampleRate?: number; + + /** + * By default, Raven.js attempts to suppress duplicate captured errors and messages that occur back-to-back. + * Such events are often triggered by rogue code (e.g. from a `setInterval` callback in a browser extension), + * are not actionable, and eat up your event quota. + */ + allowDuplicates?: boolean } interface RavenInstrumentationOptions { @@ -236,13 +243,13 @@ declare module Raven { isSetup(): boolean; /** Specify a function that allows mutation of the data payload right before being sent to Sentry. */ - setDataCallback(callback: RavenCallback): RavenStatic; + setDataCallback(callback?: RavenCallback): RavenStatic; /** Specify a callback function that allows you to mutate or filter breadcrumbs when they are captured. */ - setBreadcrumbCallback(callback: RavenCallback): RavenStatic; + setBreadcrumbCallback(callback?: RavenCallback): RavenStatic; /** Specify a callback function that allows you to apply your own filters to determine if the message should be sent to Sentry. */ - setShouldSendCallback(callback: RavenCallback): RavenStatic; + setShouldSendCallback(callback?: RavenCallback): RavenStatic; /** Show Sentry user feedback dialog */ showReportDialog(options?: Object): void; @@ -255,7 +262,7 @@ declare module Raven { setDSN(dsn: string): void; } - type RavenCallback = (data: any, orig: (data: any) => any) => any | void; + type RavenCallback = (data: any, orig?: (data: any) => any) => any | void; interface RavenTransportOptions { url: string;