Skip to content

Commit

Permalink
feat: better error message for missing peer dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
analog-nico committed Jul 12, 2016
1 parent 8c42fda commit e791f17
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/rp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ var Bluebird = require('bluebird'),
configure = require('@request/promise-core/configure/request2'),
stealthyRequire = require('stealthy-require')(require);

// Load Request freshly - so that users can require an unaltered request instance!
var request = stealthyRequire('request');
try {

// Load Request freshly - so that users can require an unaltered request instance!
var request = stealthyRequire('request');

} catch (err) {
/* istanbul ignore next */
var EOL = require('os').EOL;
/* istanbul ignore next */
console.error(EOL + '###' + EOL + '### The "request" library is not installed automatically anymore.' + EOL + '### But required by "request-promise".' + EOL + '###' + EOL + '### npm install request --save' + EOL + '###' + EOL);
/* istanbul ignore next */
throw err;
}


configure({
Expand Down

0 comments on commit e791f17

Please sign in to comment.