Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backtrace-node

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backtrace-node - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

3

lib/backtraceClient.d.ts

@@ -46,3 +46,4 @@ /// <reference types="node" />

reportSync(payload: Error | string, reportAttributes?: object | undefined, fileAttachments?: string[]): BacktraceResult;
sendReport(report: BacktraceReport): BacktraceResult;
sendReport(report: BacktraceReport, callback?: (err?: Error) => void): BacktraceResult;
sendAsync(report: BacktraceReport): Promise<BacktraceResult>;
private testClientLimits;

@@ -49,0 +50,0 @@ private samplingHit;

@@ -156,3 +156,3 @@ "use strict";

};
BacktraceClient.prototype.sendReport = function (report) {
BacktraceClient.prototype.sendReport = function (report, callback) {
var _this = this;

@@ -165,6 +165,30 @@ this.emit('before-send', report);

this._backtraceApi.send(report).then(function (result) {
if (callback) {
callback(undefined);
}
_this.emit('after-send', report, result);
}).catch(function (err) {
if (callback) {
callback(err);
}
});
return backtraceResult_1.BacktraceResult.Processing(report);
};
BacktraceClient.prototype.sendAsync = function (report) {
return __awaiter(this, void 0, void 0, function () {
var limitResult;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.emit('before-send', report);
limitResult = this.testClientLimits(report);
if (limitResult) {
return [2 /*return*/, limitResult];
}
return [4 /*yield*/, this._backtraceApi.send(report)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
BacktraceClient.prototype.testClientLimits = function (report) {

@@ -171,0 +195,0 @@ if (this.samplingHit()) {

@@ -144,7 +144,6 @@ "use strict";

backtraceReport.send = function (callback) {
backtraceClient.sendReport(backtraceReport);
callback();
backtraceClient.sendReport(backtraceReport, callback);
};
backtraceReport.sendSync = function () {
backtraceClient.sendReport(backtraceReport);
backtraceReport.sendSync = function (callback) {
backtraceClient.sendReport(backtraceReport, callback);
};

@@ -151,0 +150,0 @@ return backtraceReport;

@@ -24,3 +24,3 @@ import { IBacktraceData } from './backtraceData';

*/
send: (callback: () => void) => void | undefined;
send: (callback: (err?: Error) => void) => void | undefined;
/**

@@ -32,3 +32,3 @@ * @deprecated

*/
sendSync: () => void | undefined;
sendSync: (callback: (err?: Error) => void) => void | undefined;
/**

@@ -35,0 +35,0 @@ * Thread information about current application

{
"name": "backtrace-node",
"version": "1.0.1",
"version": "1.0.2",
"description": "Backtrace error reporting tool",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -104,3 +104,3 @@ import { ClientRateLimit } from './clientRateLimit';

public sendReport(report: BacktraceReport): BacktraceResult {
public sendReport(report: BacktraceReport, callback?: (err?: Error) => void): BacktraceResult {
this.emit('before-send', report);

@@ -112,3 +112,10 @@ const limitResult = this.testClientLimits(report);

this._backtraceApi.send(report).then((result) => {
if (callback) {
callback(undefined);
}
this.emit('after-send', report, result);
}).catch(err => {
if (callback) {
callback(err);
}
});

@@ -119,2 +126,11 @@

public async sendAsync(report: BacktraceReport): Promise<BacktraceResult> {
this.emit('before-send', report);
const limitResult = this.testClientLimits(report);
if (limitResult) {
return limitResult;
}
return await this._backtraceApi.send(report)
}
private testClientLimits(report: BacktraceReport): BacktraceResult | undefined {

@@ -121,0 +137,0 @@ if (this.samplingHit()) {

@@ -91,9 +91,8 @@ import { BacktraceClient } from './backtraceClient';

const backtraceReport = backtraceClient.createReport('');
backtraceReport.send = (callback: () => void) => {
backtraceClient.sendReport(backtraceReport);
callback();
backtraceReport.send = (callback: (err?: Error) => void) => {
backtraceClient.sendReport(backtraceReport, callback);
};
backtraceReport.sendSync = () => {
backtraceClient.sendReport(backtraceReport);
}
backtraceReport.sendSync = (callback: (err?: Error) => void) => {
backtraceClient.sendReport(backtraceReport, callback);
};

@@ -100,0 +99,0 @@ return backtraceReport;

@@ -9,2 +9,3 @@ // tslint:disable-next-line: no-var-requires

import { IBacktraceData } from './backtraceData';
import { BacktraceResult } from './backtraceResult';
import { BacktraceStackTrace } from './backtraceStackTrace';

@@ -39,3 +40,3 @@

*/
public send!: (callback: () => void) => void | undefined;
public send!: (callback: (err?: Error) => void) => void | undefined;

@@ -48,3 +49,3 @@ /**

*/
public sendSync!: () => void | undefined;
public sendSync!: (callback: (err?: Error) => void) => void | undefined;

@@ -51,0 +52,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc