Skip to content

Commit

Permalink
Remove public Honeybadger.wrap function (#506)
Browse files Browse the repository at this point in the history
* Remove public Honeybadger.wrap function

* Delete integration tests
  • Loading branch information
joshuap authored Jan 5, 2021
1 parent 4d5f1f9 commit a929373
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 46 deletions.
4 changes: 0 additions & 4 deletions src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class Honeybadger extends Client {
return (this.__errorsSent = 0)
}

wrap(func: (...args: unknown[]) => unknown): WrappedFunc {
return this.__wrap(func, { catch: true })
}

factory(opts?: Partial<BrowserConfig>): Honeybadger {
return new Honeybadger(opts)
}
Expand Down
42 changes: 0 additions & 42 deletions test/integration/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,6 @@ describe('browser integration', function () {
.catch(done);
});

it('skips global onerror handler for wrapped errors', function (done) {
sandbox
.run(function () {
Honeybadger.wrap(function () {
throw (new Error('expected message'));
})();
})
.then(function (results) {
expect(results.notices.length).toEqual(1);
done();
})
.catch(done);
});

it('reports multiple errors in the same process', function (done) {
sandbox
.run(function () {
Expand Down Expand Up @@ -396,32 +382,4 @@ describe('browser integration', function () {
})
.catch(done);
});

it('sends Honeybadger.wrap breadcrumbs when onerror is disabled', function (done) {
sandbox
.run(function () {
Honeybadger.configure({ onerror: false });
results.error = new Error('expected message');
Honeybadger.wrap(function () {
throw (results.error);
})();
})
.then(function (results) {
expect(results.notices.length).toEqual(1);
expect(results.notices[0].__breadcrumbs).toBeArray();

const errorBreadcrumbs = results.notices[0].__breadcrumbs.filter(function (c) { return c.category === 'error'; })

expect(errorBreadcrumbs.length).toEqual(1);
expect(errorBreadcrumbs[0].message).toEqual('Error');
expect(errorBreadcrumbs[0].category).toEqual('error');
expect(errorBreadcrumbs[0].metadata).toEqual(jasmine.objectContaining({
message: 'expected message',
name: 'Error',
stack: results.error.stack
}));
done();
})
.catch(done);
});
});

0 comments on commit a929373

Please sign in to comment.