I am using Vue Concurrency in my Vue 3 / TypeScript project.
And I want to create a Task that will retry x number of times if a specific kind of error is thrown.
But I can't figure out how to retry the call based on it's error message. I want to retry the call a limited number of times if the error is INVALID_OAUTH. Otherwise just throw the error like normal.
How can this be done?
For example:
const getZohoDeskTicketByIdTask = useTask(function* (signal, ticketId: string) {
const ticket: string = yield getZohoDeskTicketById({
ticketId: ticketId,
});
// If the above yield returns an error of 'INVALID_OAUTH' it should retry X number of times before failing. If the error is anything else, throw it like normal.
return ticket;
});
const ticket = await getZohoDeskTicketByIdTask.perform('12345');