Commit 220d505f authored by analog-nico's avatar analog-nico
Browse files

Failed exposing now throws an error instead of just printing to the console

parent dc74809f
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -8,7 +8,6 @@ var Bluebird = require('bluebird'),
    isString = require('lodash/lang/isString'),
    isString = require('lodash/lang/isString'),
    isUndefined = require('lodash/lang/isUndefined'),
    isUndefined = require('lodash/lang/isUndefined'),
    keys = require('lodash/object/keys'),
    keys = require('lodash/object/keys'),
    chalk = require('chalk'),
    errors = require('./errors.js');
    errors = require('./errors.js');




@@ -123,8 +122,7 @@ function expose(methodToExpose, exposeAs) {


    /* istanbul ignore if */
    /* istanbul ignore if */
    if (!isUndefined(request.Request.prototype[exposeAs])) {
    if (!isUndefined(request.Request.prototype[exposeAs])) {
        console.error(chalk.bold.bgRed('[Request-Promise] Unable to expose method "' + exposeAs + '". It is already implemented by Request. Please visit https://github.com/request/request-promise/wiki/Troubleshooting'));
        throw new Error('[Request-Promise] Unable to expose method "' + exposeAs + '". It is already implemented by Request. Please visit https://github.com/request/request-promise/wiki/Troubleshooting');
        return;
    }
    }


    request.Request.prototype[exposeAs] = function RP$exposed() {
    request.Request.prototype[exposeAs] = function RP$exposed() {
+0 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@
  },
  },
  "dependencies": {
  "dependencies": {
    "bluebird": "^2.3",
    "bluebird": "^2.3",
    "chalk": "^1.1.0",
    "lodash": "^3.10.0",
    "lodash": "^3.10.0",
    "request": "^2.34"
    "request": "^2.34"
  },
  },