I read that it is better to use request-promise instead of request, because there is better error handling.
In request:
request('http://www.google.com', function (error, response, body) {
if (error) console.log(error);
//operations...
});
In request-promise:
rp('http://www.google.com')
.then(function (htmlString) {
// operations..
// operations..
testerror; // line 5
})
.catch(function (err) {
console.log(err); // line 8
});
But if I have error in line 5 then console.log show that error is line 8 then if it isn't from request-promise just from my code then I don't know what happened.
How in request-promise I can show error line - 5, not 8?