I just wanted to know if it's a good practice to use the following code:
const myFun = async () => {
try {
const response = await api();
if(response.status === 200) {
return response.data;
}
} catch(err) {
return Promise.reject(err);
}
}
Here myFun will return a resolved/reject Promise that will be caught by another function. I just wanted to know if this is right way or are there any alternatives?