Skip to content

Commit d0ce076

Browse files
committed
ref: Rename send on transport to captureEvent
1 parent caea4f8 commit d0ce076

File tree

15 files changed

+26
-26
lines changed

15 files changed

+26
-26
lines changed

packages/browser/src/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class BrowserBackend implements Backend {
161161
}
162162
}
163163

164-
return this.transport.send(event);
164+
return this.transport.captureEvent(event);
165165
}
166166

167167
/**

packages/browser/src/transports/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export abstract class BaseTransport implements Transport {
1515
/**
1616
* @inheritDoc
1717
*/
18-
public async send(_: SentryEvent): Promise<SentryResponse> {
19-
throw new SentryError('Transport Class has to implement `send` method');
18+
public async captureEvent(_: SentryEvent): Promise<SentryResponse> {
19+
throw new SentryError('Transport Class has to implement `captureEvent` method');
2020
}
2121
}

packages/browser/src/transports/beacon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class BeaconTransport extends BaseTransport {
1010
/**
1111
* @inheritDoc
1212
*/
13-
public async send(event: SentryEvent): Promise<SentryResponse> {
13+
public async captureEvent(event: SentryEvent): Promise<SentryResponse> {
1414
const data = serialize(event);
1515

1616
const result = global.navigator.sendBeacon(this.url, data);

packages/browser/src/transports/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class FetchTransport extends BaseTransport {
1111
/**
1212
* @inheritDoc
1313
*/
14-
public async send(event: SentryEvent): Promise<SentryResponse> {
14+
public async captureEvent(event: SentryEvent): Promise<SentryResponse> {
1515
const defaultOptions: RequestInit = {
1616
body: serialize(event),
1717
method: 'POST',

packages/browser/src/transports/xhr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class XHRTransport extends BaseTransport {
77
/**
88
* @inheritDoc
99
*/
10-
public async send(event: SentryEvent): Promise<SentryResponse> {
10+
public async captureEvent(event: SentryEvent): Promise<SentryResponse> {
1111
return new Promise<SentryResponse>((resolve, reject) => {
1212
const request = new XMLHttpRequest();
1313

packages/browser/test/backend.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BrowserBackend } from '../src/backend';
44
import { BaseTransport } from '../src/transports';
55

66
class SimpleTransport extends BaseTransport {
7-
public async send(_: SentryEvent): Promise<SentryResponse> {
7+
public async captureEvent(_: SentryEvent): Promise<SentryResponse> {
88
return {
99
status: Status.fromHttpCode(200),
1010
};
@@ -34,7 +34,7 @@ describe('BrowserBackend', () => {
3434
}
3535
});
3636

37-
it('should call send() on provided transport', async () => {
37+
it('should call captureEvent() on provided transport', async () => {
3838
backend = new BrowserBackend({ dsn, transport: SimpleTransport });
3939
const status = await backend.sendEvent(testEvent);
4040
expect(status.status).equal(Status.Success);

packages/browser/test/transports/base.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const testDsn = 'https://[email protected]/42';
66
class SimpleTransport extends BaseTransport {}
77

88
describe('BaseTransport', () => {
9-
it('doesnt provide send() implementation', async () => {
10-
const transport = new SimpleTransport({ dsn: testDsn });
9+
it('doesnt provide captureEvent() implementation', async () => {
10+
const transport = new SimpleTransport({ dsn: testDSN });
1111

1212
try {
13-
await transport.send({});
13+
await transport.captureEvent({});
1414
} catch (e) {
15-
expect(e.message).equal('Transport Class has to implement `send` method');
15+
expect(e.message).equal('Transport Class has to implement `captureEvent` method');
1616
}
1717
});
1818

packages/browser/test/transports/beacon.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ describe('BeaconTransport', () => {
2929
expect(transport.url).equal(transportUrl);
3030
});
3131

32-
describe('send()', async () => {
32+
describe('captureEvent()', async () => {
3333
it('sends a request to Sentry servers', async () => {
3434
sendBeacon.returns(true);
3535

36-
return transport.send(payload).then(res => {
36+
return transport.captureEvent(payload).then(res => {
3737
expect(res.status).equal(Status.Success);
3838
expect(sendBeacon.calledOnce).equal(true);
3939
expect(sendBeacon.calledWith(transportUrl, JSON.stringify(payload))).equal(true);
@@ -43,7 +43,7 @@ describe('BeaconTransport', () => {
4343
it('rejects with failed status', async () => {
4444
sendBeacon.returns(false);
4545

46-
return transport.send(payload).catch(res => {
46+
return transport.captureEvent(payload).catch(res => {
4747
expect(res.status).equal(Status.Failed);
4848
expect(sendBeacon.calledOnce).equal(true);
4949
expect(sendBeacon.calledWith(transportUrl, JSON.stringify(payload))).equal(true);

packages/browser/test/transports/fetch.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ describe('FetchTransport', () => {
2929
expect(transport.url).equal(transportUrl);
3030
});
3131

32-
describe('send()', async () => {
32+
describe('captureEvent()', async () => {
3333
it('sends a request to Sentry servers', async () => {
3434
const response = { status: 200 };
3535

3636
fetch.returns(Promise.resolve(response));
3737

38-
return transport.send(payload).then(res => {
38+
return transport.captureEvent(payload).then(res => {
3939
expect(res.status).equal(Status.Success);
4040
expect(fetch.calledOnce).equal(true);
4141
expect(
@@ -53,7 +53,7 @@ describe('FetchTransport', () => {
5353

5454
fetch.returns(Promise.reject(response));
5555

56-
return transport.send(payload).catch(res => {
56+
return transport.captureEvent(payload).catch(res => {
5757
expect(res.status).equal(403);
5858
expect(fetch.calledOnce).equal(true);
5959
expect(

packages/browser/test/transports/xhr.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ describe('XHRTransport', () => {
3030
expect(transport.url).equal(transportUrl);
3131
});
3232

33-
describe('send()', async () => {
33+
describe('captureEvent()', async () => {
3434
it('sends a request to Sentry servers', async () => {
3535
server.respondWith('POST', transportUrl, [200, {}, '']);
3636

37-
return transport.send(payload).then(res => {
37+
return transport.captureEvent(payload).then(res => {
3838
expect(res.status).equal(Status.Success);
3939
const request = server.requests[0];
4040
expect(server.requests.length).equal(1);
@@ -46,7 +46,7 @@ describe('XHRTransport', () => {
4646
it('rejects with non-200 status code', done => {
4747
server.respondWith('POST', transportUrl, [403, {}, '']);
4848

49-
transport.send(payload).catch(res => {
49+
transport.captureEvent(payload).catch(res => {
5050
expect(res.status).equal(403);
5151

5252
const request = server.requests[0];

packages/node/src/backend.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class NodeBackend implements Backend {
105105
: new HTTPSTransport(transportOptions);
106106
}
107107

108-
return this.transport.send(event);
108+
return this.transport.captureEvent(event);
109109
}
110110

111111
/**

packages/node/src/transports/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export abstract class BaseTransport implements Transport {
7777
/**
7878
* @inheritDoc
7979
*/
80-
public async send(_: SentryEvent): Promise<SentryResponse> {
80+
public async captureEvent(_: SentryEvent): Promise<SentryResponse> {
8181
throw new SentryError('Transport Class has to implement `send` method');
8282
}
8383
}

packages/node/src/transports/http.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class HTTPTransport extends BaseTransport {
1313
/**
1414
* @inheritDoc
1515
*/
16-
public async send(event: SentryEvent): Promise<SentryResponse> {
16+
public async captureEvent(event: SentryEvent): Promise<SentryResponse> {
1717
return this.sendWithModule(http, event);
1818
}
1919
}

packages/node/src/transports/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class HTTPSTransport extends BaseTransport {
1313
/**
1414
* @inheritDoc
1515
*/
16-
public async send(event: SentryEvent): Promise<SentryResponse> {
16+
public async captureEvent(event: SentryEvent): Promise<SentryResponse> {
1717
return this.sendWithModule(https, event);
1818
}
1919
}

packages/types/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export interface TransportOptions {
222222

223223
/** JSDoc */
224224
export interface Transport {
225-
send(event: SentryEvent): Promise<SentryResponse>;
225+
captureEvent(event: SentryEvent): Promise<SentryResponse>;
226226
}
227227

228228
/** JSDoc */

0 commit comments

Comments
 (0)