Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]Adding type for InngestStepError to handle the onfailure logic based on failed step #397

Open
anasabdullahysfzai opened this issue Nov 14, 2023 · 1 comment
Labels
📦 inngest Affects the `inngest` package ✨ new New features, integrations, or exports

Comments

@anasabdullahysfzai
Copy link
Contributor

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 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;
}

}
`

@anasabdullahysfzai anasabdullahysfzai changed the title Adding type for InngestStepError to handle the onfailure logic based on failed step [FEATURE]Adding type for InngestStepError to handle the onfailure logic based on failed step Nov 15, 2023
@jpwilliams jpwilliams added 📦 inngest Affects the `inngest` package ✨ new New features, integrations, or exports labels Nov 17, 2023
@anasabdullahysfzai
Copy link
Contributor Author

@jpwilliams can i work on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 inngest Affects the `inngest` package ✨ new New features, integrations, or exports
Projects
None yet
Development

No branches or pull requests

2 participants