I'm calling an async function which returns an array of promises to deal with the fact that eslint won't let you use await in a for loop...
my function is passing strings from an array one by one into another function which is doing some encoding and then waiting for them all to finish before returning the final encoded values as you can imagine a few things screw up on the encoding side and that module will throw relevant errors as needed
my issue is that unfortunately, when returning an array of promises those errors will not show on the stack trace... the only error that I get back is a generic 500 server error but none of my custom errors show
async function decodedAddresses(req, addresses) {
if (!Array.isArray(addresses)) {
return decodeId(req, addressId, idType.address);
}
return Promise.all(
addresses.map(id => {
return decoded(req, id).then(addr => {
return {
address: addr,
};
});
})
).
});
}
however if I simply call my function and have it return this way without the array of promises I have no issues and all the errors appear on the stack trace
async function decodedAddresses(req, addresses) {
return decoded(req, id)
}
also the length of the addresses does not matter it can be an array[1] or array[2] etc... the same issue occurs, I'm hoping someone might have some insight into why an array of promises may somehow be overwriting or not placing these errors on the stack