(err)
| 79 | let calledCount = 0; |
| 80 | const { promise, resolve, reject } = PromiseWithResolvers(); |
| 81 | const cb = (err) => { |
| 82 | calledCount++; |
| 83 | |
| 84 | // If the callback is called a second time, let the user know, but |
| 85 | // don't let them know more than once. |
| 86 | if (calledCount > 1) { |
| 87 | if (calledCount === 2) { |
| 88 | throw new ERR_TEST_FAILURE( |
| 89 | 'callback invoked multiple times', |
| 90 | kMultipleCallbackInvocations, |
| 91 | ); |
| 92 | } |
| 93 | |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | if (err) { |
| 98 | return reject(err); |
| 99 | } |
| 100 | |
| 101 | resolve(); |
| 102 | }; |
| 103 | |
| 104 | return { __proto__: null, promise, cb }; |
| 105 | } |
no test coverage detected