MCPcopy
hub / github.com/mongodb/node-mongodb-native / promiseTry

Function promiseTry

test/tools/spec-runner/index.js:22–30  ·  view source on GitHub ↗
(callback)

Source from the content-addressed store, hash-verified

20
21// Promise.try alternative https://stackoverflow.com/questions/60624081/promise-try-without-bluebird/60624164?noredirect=1#comment107255389_60624164
22function promiseTry(callback) {
23 return new Promise((resolve, reject) => {
24 try {
25 resolve(callback());
26 } catch (e) {
27 reject(e);
28 }
29 });
30}
31
32chai.use(require('chai-subset'));
33chai.use(require('./matcher').default);

Callers 1

testOperationFunction · 0.85

Calls 2

resolveFunction · 0.50
callbackFunction · 0.50

Tested by

no test coverage detected