How to use the CancellationError function from bluebird

Find comprehensive JavaScript bluebird.CancellationError code examples handpicked from public code repositorys.

32
33
34
35
36
37
38
39
40
41
})
.on('error', function(err) {
  reject(err);
})
.on('abort', function() {
  reject(new Promise.CancellationError());
})
.on('timeout', function() {
  reject(new Promise.TimeoutError());
});
fork icon5
star icon56
watch icon1

21
22
23
24
25
26
27
28
29
30
  req.on('error', function (err) {
    reject(err);
  });

  req.on('abort', function () {
    reject(new Promise.CancellationError("Request aborted"));
  });

})
.cancellable()
fork icon7
star icon16
watch icon9

3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390


},{}],15:[function(_dereq_,module,exports){
"use strict";
module.exports = function(Promise, tryConvertToPromise) {
var util = _dereq_("./util");
var CancellationError = Promise.CancellationError;
var errorObj = util.errorObj;


function PassThroughHandlerContext(promise, type, handler) {
    this.promise = promise;
fork icon3
star icon16
watch icon0

357
358
359
360
361
362
363
364
365
366

return Promise.all([
  fs.statAsync(path),
  this._refreshing
]).spread(function (stat) {
  if (stat.mtime <= file.mtime) throw new Promise.CancellationError()

  file.mtime = stat.mtime
  return self._preprocess(file)
})
fork icon0
star icon0
watch icon0