@platformos/pos-cli
Version:
Manage your platformOS application
52 lines • 1.67 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("@sentry/utils");
var noop_1 = require("./transports/noop");
/**
* This is the base implemention of a Backend.
* @hidden
*/
var BaseBackend = /** @class */ (function () {
/** Creates a new backend instance. */
function BaseBackend(options) {
this._options = options;
if (!this._options.dsn) {
utils_1.logger.warn('No DSN provided, backend will not do anything.');
}
this._transport = this._setupTransport();
}
/**
* Sets up the transport so it can be used later to send requests.
*/
BaseBackend.prototype._setupTransport = function () {
return new noop_1.NoopTransport();
};
/**
* @inheritDoc
*/
BaseBackend.prototype.eventFromException = function (_exception, _hint) {
throw new utils_1.SentryError('Backend has to implement `eventFromException` method');
};
/**
* @inheritDoc
*/
BaseBackend.prototype.eventFromMessage = function (_message, _level, _hint) {
throw new utils_1.SentryError('Backend has to implement `eventFromMessage` method');
};
/**
* @inheritDoc
*/
BaseBackend.prototype.sendEvent = function (event) {
this._transport.sendEvent(event).then(null, function (reason) {
utils_1.logger.error("Error while sending event: " + reason);
});
};
/**
* @inheritDoc
*/
BaseBackend.prototype.getTransport = function () {
return this._transport;
};
return BaseBackend;
}());
exports.BaseBackend = BaseBackend;
//# sourceMappingURL=basebackend.js.map