Skip to content

feat: support async io.runTask error callback #909

Closed
@minyoung

Description

@minyoung

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions