(error, callback)
| 383 | }, |
| 384 | |
| 385 | destroy(error, callback) { |
| 386 | function done() { |
| 387 | try { |
| 388 | callback(error); |
| 389 | } catch (error) { |
| 390 | // In a next tick because this is happening within |
| 391 | // a promise context, and if there are any errors |
| 392 | // thrown we don't want those to cause an unhandled |
| 393 | // rejection. Let's just escape the promise and |
| 394 | // handle it separately. |
| 395 | process.nextTick(() => { throw error; }); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | if (!closed) { |
| 400 | if (error != null) { |
| 401 | PromisePrototypeThen( |
| 402 | writer.abort(error), |
| 403 | done, |
| 404 | done); |
| 405 | } else { |
| 406 | PromisePrototypeThen( |
| 407 | writer.close(), |
| 408 | done, |
| 409 | done); |
| 410 | } |
| 411 | return; |
| 412 | } |
| 413 | |
| 414 | done(); |
| 415 | }, |
| 416 | |
| 417 | final(callback) { |
| 418 | function done(error) { |
no test coverage detected
searching dependent graphs…