Commit ac805811 authored by analog-nico's avatar analog-nico
Browse files

Added .promise() and function names for inspection

parent 40999d9c
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -118,16 +118,21 @@ function markPromiseInUse(requestInstance) {
    requestInstance._rp_promise._rp_in_use = true;
    requestInstance._rp_promise._rp_in_use = true;
}
}


request.Request.prototype.then = function (onFulfilled, onRejected) {
request.Request.prototype.then = function RP$then(onFulfilled, onRejected) {
    markPromiseInUse(this);
    markPromiseInUse(this);
    return this._rp_promise.then.apply(this._rp_promise, arguments);
    return this._rp_promise.then.apply(this._rp_promise, arguments);
};
};


request.Request.prototype.catch = function (onRejected) {
request.Request.prototype.catch = function RP$catch(onRejected) {
    markPromiseInUse(this);
    markPromiseInUse(this);
    return this._rp_promise.catch.apply(this._rp_promise, arguments);
    return this._rp_promise.catch.apply(this._rp_promise, arguments);
};
};


request.Request.prototype.promise = function RP$promise() {
    markPromiseInUse(this);
    return this._rp_promise;
};



Bluebird.onPossiblyUnhandledRejection(function (reason, promise) {
Bluebird.onPossiblyUnhandledRejection(function (reason, promise) {
    // For whatever reason we don't see _rp_in_use here at all after then is called. --> We compare to false instead of true.
    // For whatever reason we don't see _rp_in_use here at all after then is called. --> We compare to false instead of true.