I came into possession of a codebase filled with functions like the one below:
const someFunc = async (): Promise<string> => {
return new Promise(async (resolve, reject) => {
try {
const result = await doSomething();
resolve(result);
} catch (error) {
reject(error);
}
});
};
As far as I can tell, since the error handling is not included in the catch
block, this function is essentially the same as the simplified version below:
const someFunc = (): Promise<string> => {
return doSomething();
};
Am I overlooking something here?