Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ef30661
polished raven.d.ts
LucaVazz Jan 12, 2017
98a83c1
updated author information of raven.d.ts
LucaVazz Jan 12, 2017
2e590d2
added extra to RavenUserContext
LucaVazz Jan 12, 2017
cc9fc47
small fixes
LucaVazz Jan 12, 2017
592e542
copied fixes from PR in DefenitivelyTyped
LucaVazz Jan 13, 2017
089efdd
fixed tsc --noEmit --noImplicitAny typescript/raven-tests.ts
LucaVazz Jan 23, 2017
305d38b
made `data: any` in set...Calback more specific
LucaVazz Jan 24, 2017
949bc5d
added missing values to RavenOutgoingData
LucaVazz Jan 24, 2017
d0d32c8
replaced any in setBreadcrumbCallback
LucaVazz Jan 24, 2017
e562d5c
made options for setTransport more specific
LucaVazz Jan 24, 2017
a53a044
set user in RavenOutgoingData to RavenUserContext instead of any
LucaVazz Jan 24, 2017
f46fde8
fixed missed RavenTransportOptions (-> RavenTransportFunctionOptions …
LucaVazz Jan 24, 2017
7fdef1f
fixed interface-props terminated by `;` to be terminated by `;`
LucaVazz Jan 24, 2017
9f38a30
Merge branch 'master' of https://github.com/getsentry/raven-js
LucaVazz Jan 24, 2017
1f55f01
re-added accidentally deleted tests (in a fixed version)
LucaVazz Jan 31, 2017
3e51fc6
fixed typo in RavenBreadcrumbOptions
LucaVazz Jan 31, 2017
ac60fe3
added a proposal for a PR-Template
LucaVazz Jan 31, 2017
10d48cc
removed redundant testing from the PR-Template
LucaVazz Jan 31, 2017
60a7809
fix optionals in RavenBreadcrumb
LucaVazz Feb 16, 2017
5e92191
added tests for captureBreadcrumb
LucaVazz Feb 16, 2017
634908c
fixed erroneous optionals from the last commit
LucaVazz Feb 16, 2017
d8941cf
removed PR-Template
LucaVazz Feb 19, 2017
e034ba6
Merge branch 'master' of https://github.com/LucaVazz/raven-js
LucaVazz Feb 19, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
copied fixes from PR in DefenitivelyTyped
  • Loading branch information
LucaVazz committed Jan 13, 2017
commit 592e542247be1ccd9801d569446f99731860dafc
93 changes: 42 additions & 51 deletions typescript/raven-tests.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import Raven = require('..');

Raven.config('https://public@sentry.io/1').install();

var options = {
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i,
'graph.facebook.com'
],
ignoreErrors: [
/fb_xd_fragment/,
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
'https://www.sentry.io'
],
whitelistUrls: [
/https?:\/\/google\.com/,
'https://www.google.com'
]
};

Raven.config('https://public@sentry.io/1', options).install();
import RavenJS from 'raven-js';

RavenJS.config('https://public@getsentry.com/1').install();


RavenJS.config(
'https://public@getsentry.com/1',
{
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i
],
ignoreErrors: [
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
]
}
).install();

var throwsError = () => {
throw new Error('broken');
Expand All @@ -31,40 +27,35 @@ var throwsError = () => {
try {
throwsError();
} catch(e) {
Raven.captureException(e);
Raven.captureException(e, {tags: { key: "value" }});
RavenJS.captureException(e);
RavenJS.captureException(e, {tags: { key: "value" }});
}

Raven.context(throwsError);
Raven.context({tags: { key: "value" }}, throwsError);
RavenJS.context(throwsError);
RavenJS.context({tags: { key: "value" }}, throwsError);
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);

setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
setTimeout(RavenJS.wrap(throwsError), 1000);
RavenJS.wrap({logger: "my.module"}, throwsError)();
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();

Raven.setUserContext({
RavenJS.setUserContext({
email: 'matt@example.com',
id: '123'
});

Raven.setExtraContext({foo: 'bar'});
Raven.setTagsContext({env: 'prod'});
Raven.clearContext();
var obj:Object = Raven.getContext();
var err:Error = Raven.lastException();
RavenJS.captureMessage('Broken!');
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});

Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
+Raven.captureMessage('Broken!', { stacktrace: true });
Raven.captureBreadcrumb({});

Raven.setRelease('abc123');
Raven.setEnvironment('production');
RavenJS.showReportDialog({
eventId: 0815,
dsn:'1337asdf',
user: {
name: 'DefenitelyTyped',
email: 'df@ts.ms'
}
});

Raven.setDataCallback(function (data: any) {});
Raven.setDataCallback(function (data: any, original: any) {});
Raven.setShouldSendCallback(function (data: any) {});
Raven.setShouldSendCallback(function (data: any, original: any) {});
RavenJS.setTagsContext({ key: "value" });

Raven.showReportDialog({
eventId: 'abcdef123456'
});
RavenJS.setExtraContext({ foo: "bar" });
30 changes: 13 additions & 17 deletions typescript/raven.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Type definitions for Raven.js
// Type definitions for Raven.js
// Project: https://github.com/getsentry/raven-js
// Original Definitions by: Santi Albo <https://github.com/santialbo>, Benjamin Pannell
// <http://github.com/spartan563>; DefinitelyTyped
// Updated by: Ben Vinegar <https://github.com/benvinegar>, Ilya Pirogov
// <https://github.com/ilya-pirogov>, Eli White <https://github.com/TheSavior>, David Cramer
// <https://github.com/dcramer>, Connor Peet <https://github.com/connor4312>, comaz
// <https://github.com/combmag>, Luca Vazzano <https://github.com/LucaVazz>
// Definitions by: Santi Albo <https://github.com/santialbo/>, Benjamin Pannell <http://github.com/spartan563>, Gary Blackwood <http://github.com/Garee>, Rich Rout <http://github.com/richrout>, Ben Vinegar <https://github.com/benvinegar>, Ilya Pirogov <https://github.com/ilya-pirogov>, Eli White <https://github.com/TheSavior>, David Cramer <https://github.com/dcramer>, Connor Peet <https://github.com/connor4312>, comaz <https://github.com/combmag>, Luca Vazzano <https://github.com/LucaVazz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped


declare let Raven: RavenStatic;
Expand Down Expand Up @@ -200,7 +196,7 @@ interface RavenStatic {


// --- Helper Interfaces for Options --------------
interface RavenBreadcrumOptions {
export interface RavenBreadcrumOptions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: Breadcrum

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 3e51fc6

/** Whether to collect XHR calls, defaults to true */
xhr?: boolean;

Expand All @@ -214,7 +210,7 @@ interface RavenBreadcrumOptions {
location?: boolean;
}

interface CommonRavenOptions {
export interface CommonRavenOptions {
/** The environment of the application you are monitoring with Sentry */
environment?: string;

Expand All @@ -234,7 +230,7 @@ interface CommonRavenOptions {
stacktrace?: boolean;
}

interface RavenOptions extends CommonRavenOptions {
export interface RavenOptions extends CommonRavenOptions {
/** The name of the server or device that the client is running on */
server_name?: string;

Expand All @@ -253,7 +249,7 @@ interface RavenOptions extends CommonRavenOptions {
platform?: string;
}

interface RavenGlobalOptions extends CommonRavenOptions {
export interface RavenGlobalOptions extends CommonRavenOptions {
/** The name of the server or device that the client is running on */
serverName?: string;

Expand Down Expand Up @@ -294,12 +290,12 @@ interface RavenGlobalOptions extends CommonRavenOptions {
dataCallback?: (data: any) => any;
}

interface RavenWrapOptions extends RavenOptions {
export interface RavenWrapOptions extends RavenOptions {
/** Whether to run the wrap recursively. Default: false. */
deep?: boolean;
}

interface RavenTransportOptions {
export interface RavenTransportOptions {
url: string;
data: any;
auth: {
Expand All @@ -311,7 +307,7 @@ interface RavenTransportOptions {
onFailure: () => void;
}

interface RavenReportDialogOptions {
export interface RavenReportDialogOptions {
eventId?: number,
dsn?: string,
user?: {
Expand All @@ -322,19 +318,19 @@ interface RavenReportDialogOptions {


// --- Helper Interfaces for complex Data Structures --------------
interface RavenPlugin {
export interface RavenPlugin {
(raven: RavenStatic, ...args: any[]): RavenStatic;
}

interface RavenUserContext {
export interface RavenUserContext {
id?: string;
username?: string;
email?: string;
ip_address?: string;
extra?: { [prop: string]: any };
}

interface RavenBreadcrumb {
export interface RavenBreadcrumb {
message: string;
data: { [id: string]: string };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this allow for free-form objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the RavenUserContext or RavenBreadcrumb?

category: string;
Expand Down