You don't return anything from inside new Promise
. Whatever you return is just thrown away, What you do is resolve and reject. If you want to "return" something, including another promise, what you do is resolve with that something.
So what you want is
new Promise((resolve, reject) => {
//function call with returned promise...
resolve(new Promise((resolve, reject) => {
^^^^^^^
reject("rejectCall_2")
}));
}).catch(e1 => {
console.log('e1', e1)
})
Tested with babel-node.
FWIW, you might as well use the immediate return fat-arrow format and save yourself a few curly braces:
new Promise((resolve, reject) =>
resolve(new Promise((resolve, reject) =>
reject("rejectCall_2")
));
).catch( e1 => console.log('e1',e1));
I would take note of the comments which suggest you may be guilty of the "explicit promise constructor anti-pattern', where you construct a promise only to resolve or reject it with some other promise that you could have just used in the first place. I'm assuming your example is an artificial one designed to showcase your particular issue.