So, I have this code base:
const axios = require('axios');
const req = axios.get('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQYnIfSxQXlLcfndCeenvH8kvgjKfaW51rQpTSR05fOYH6q8Rlt');
Promise.reject(req).then(null, () => {
console.log('first error --- fired',);
return new Error('Error')
});
// req is still fine here despite I have rejected it above
req
.then(() => {
console.log('data --- okay');
}).catch(() => {
console.log('error --- fired',);
})
Soo, after querying image I am rejecting req instance and expecting that req
will be in rejected state, but instead it still in pending
state and I can access it below my comment.
Why?
How may I reject it completely?
Thanks!