function fetch(options) {
return new Promise((resolve, reject) => {
this.request(options, (err, response, status, xhr) => {
console.log('err res', err, response);//#console2
return err ? reject(err) : resolve(response);
});
});
}
This is my block of code.
I have already seen a lot of related questions but still couldn't find anything.
In my case, I'm calling this fetch
method from 2 places within a project with the same input and I'm getting the same error for both the time i.e till #console2 everything is the same but while returning one time it is throwing warning promise was rejected with a non-error:
and for another call, it is not throwing anything.
Please let me know if anyone is aware of this issue.
Thanks in advance :) .
function fetch(.....
? this.request
does. Apparently it sometimes calls its callback with a non-Error
value for the err
parameter. this.request
and show us how it is calling the callback function. We cannot help you otherwise. That it works for another request does not matter, apparently the code is doing something different (probably due to receiving a different response) there.