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

feat: support async io.runTask error callback #909

Open
minyoung opened this issue Feb 23, 2024 · 0 comments · May be fixed by #910
Open

feat: support async io.runTask error callback #909

minyoung opened this issue Feb 23, 2024 · 0 comments · May be fixed by #910

Comments

@minyoung
Copy link

Is your feature request related to a problem? Please describe.

When io.runTask runs, it has an onError callback option. This is great!
But I have some async logic that I would like to run in this error callback. This is currently not supported since the error callback cannot return a promise.

Describe the solution you'd like to see

Update RunTaskErrorCallback type to allow returning a promise, and update io.runTask to await onError(error, task, this)

Describe alternate solutions

Do nothing and tell developers to try/catch inside the io.runTask (where it is async):

io.runTask(
  "name",
  async (task) => {
    try {
      // ...
    } catch (error) {
      await sendErrorNotification(payload)
    }
  },
)

Additional information

No response

@minyoung minyoung linked a pull request Feb 23, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant