Question
How to use the retry from Rxjs to my await function?
I have to return an await function from my code block, now when the await function is called and failed on the first try, I want to retry it again and if it failed on the second time.. I will show an error message.
THIS IS MY CODE
async makeCall(inputs: myInputs): Promise<Instance> {
const emailOptions: CreateOptions = {
to: inputs.toPhone,
from: this.config.accountPhoneNumber
};
if (inputs.toPhone) {
emailOptions.sendText = inputs.toPhone;
}
return await this.sample.create(emailOptions);
}
I WANT SOMETHING LIKE THIS OR ANY SUGGESTION? LIKE Retry from RxJs
for(var i = 0; i < 1; i++)
{
var result = await this.sample.create(emailOptions);
if(result)
{
// break the loop
return result;
}
}
// if we land here, so the number of retries was exceeded
throw Error("...");
2 28
2