So i have been working on a multistep function where the onFailure logic was different based on the step that failed. I didnt find a way to handle this in inngest
As a workaround , i had to pass the step name property within the error object like below
I think we can handle this issue on inngest level by introducing a new type called InngestStepError which includes the step name (name of failed step) and the original error that was thrown while running the step. So we can throw error like this
throw new InngestStepError({step: "scrape-website"},error)
And handle the onFailure based on step
`
onFailure: async ({ error, event }) => {
switch(error.step) {
case "scrape-website":
// Do Something
break;
case "step-2":
// Do Something
break;
}
So i have been working on a multistep function where the onFailure logic was different based on the step that failed. I didnt find a way to handle this in inngest
As a workaround , i had to pass the step name property within the error object like below
throw { step: "scrape-website", error: error_instance }
I think we can handle this issue on inngest level by introducing a new type called
InngestStepError
which includes the step name (name of failed step) and the original error that was thrown while running the step. So we can throw error like thisthrow new InngestStepError({step: "scrape-website"},error)
And handle the onFailure based on step
` onFailure: async ({ error, event }) => {
switch(error.step) { case "scrape-website": // Do Something break; case "step-2": // Do Something break; }
} `