1 | Object.defineProperty(exports, "__esModule", { value: true });
|
2 | var utils_1 = require("@sentry/utils");
|
3 | var noop_1 = require("./transports/noop");
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var BaseBackend = (function () {
|
9 |
|
10 | function BaseBackend(options) {
|
11 | this._options = options;
|
12 | if (!this._options.dsn) {
|
13 | utils_1.logger.warn('No DSN provided, backend will not do anything.');
|
14 | }
|
15 | this._transport = this._setupTransport();
|
16 | }
|
17 | |
18 |
|
19 |
|
20 |
|
21 | BaseBackend.prototype.eventFromException = function (_exception, _hint) {
|
22 | throw new utils_1.SentryError('Backend has to implement `eventFromException` method');
|
23 | };
|
24 | |
25 |
|
26 |
|
27 | BaseBackend.prototype.eventFromMessage = function (_message, _level, _hint) {
|
28 | throw new utils_1.SentryError('Backend has to implement `eventFromMessage` method');
|
29 | };
|
30 | |
31 |
|
32 |
|
33 | BaseBackend.prototype.sendEvent = function (event) {
|
34 | void this._transport.sendEvent(event).then(null, function (reason) {
|
35 | utils_1.logger.error("Error while sending event: " + reason);
|
36 | });
|
37 | };
|
38 | |
39 |
|
40 |
|
41 | BaseBackend.prototype.sendSession = function (session) {
|
42 | if (!this._transport.sendSession) {
|
43 | utils_1.logger.warn("Dropping session because custom transport doesn't implement sendSession");
|
44 | return;
|
45 | }
|
46 | void this._transport.sendSession(session).then(null, function (reason) {
|
47 | utils_1.logger.error("Error while sending session: " + reason);
|
48 | });
|
49 | };
|
50 | |
51 |
|
52 |
|
53 | BaseBackend.prototype.getTransport = function () {
|
54 | return this._transport;
|
55 | };
|
56 | |
57 |
|
58 |
|
59 | BaseBackend.prototype._setupTransport = function () {
|
60 | return new noop_1.NoopTransport();
|
61 | };
|
62 | return BaseBackend;
|
63 | }());
|
64 | exports.BaseBackend = BaseBackend;
|
65 |
|
\ | No newline at end of file |