Loading lib/bluebird-captured-trace-fresh.js 0 → 100644 +1 −0 Original line number Diff line number Diff line module.exports = require("bluebird/js/main/captured_trace")(); lib/bluebird-fresh.js 0 → 100644 +2 −0 Original line number Diff line number Diff line // See: https://github.com/petkaantonov/bluebird#for-library-authors module.exports = require("bluebird/js/main/promise")(); lib/rp.js +9 −3 Original line number Diff line number Diff line 'use strict'; var Bluebird = require('bluebird'), var Bluebird = require('./bluebird-fresh.js'), printRejectionReason = require('./bluebird-captured-trace-fresh.js').possiblyUnhandledRejection, _ = require('lodash'); Bluebird.onPossiblyUnhandledRejection(function (err) { // FIXME: Only ignore them if the user did not invoke 'then' yet. Bluebird.onPossiblyUnhandledRejection(function (reason, promise) { if (promise._rp_then_invoked === true) { printRejectionReason(reason); } // else: The user did not call .then(...) // --> We need to assume that this request is processed with a callback or a pipe etc. }); Loading Loading @@ -118,6 +123,7 @@ request.Request.prototype.init = function (options) { request.Request.prototype.then = function (onFulfilled, onRejected) { this._rp_then_invoked = true; this._rp_promise._rp_then_invoked = true; return this._rp_promise.then(onFulfilled, onRejected); }; Loading Loading
lib/bluebird-captured-trace-fresh.js 0 → 100644 +1 −0 Original line number Diff line number Diff line module.exports = require("bluebird/js/main/captured_trace")();
lib/bluebird-fresh.js 0 → 100644 +2 −0 Original line number Diff line number Diff line // See: https://github.com/petkaantonov/bluebird#for-library-authors module.exports = require("bluebird/js/main/promise")();
lib/rp.js +9 −3 Original line number Diff line number Diff line 'use strict'; var Bluebird = require('bluebird'), var Bluebird = require('./bluebird-fresh.js'), printRejectionReason = require('./bluebird-captured-trace-fresh.js').possiblyUnhandledRejection, _ = require('lodash'); Bluebird.onPossiblyUnhandledRejection(function (err) { // FIXME: Only ignore them if the user did not invoke 'then' yet. Bluebird.onPossiblyUnhandledRejection(function (reason, promise) { if (promise._rp_then_invoked === true) { printRejectionReason(reason); } // else: The user did not call .then(...) // --> We need to assume that this request is processed with a callback or a pipe etc. }); Loading Loading @@ -118,6 +123,7 @@ request.Request.prototype.init = function (options) { request.Request.prototype.then = function (onFulfilled, onRejected) { this._rp_then_invoked = true; this._rp_promise._rp_then_invoked = true; return this._rp_promise.then(onFulfilled, onRejected); }; Loading