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

fix(task_manager): allow tasks to sometimes fail via return value #23

Merged
merged 2 commits into from
Mar 12, 2025

Conversation

mini-bomba
Copy link
Contributor

πŸ”— Linked issue

fixes #22

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

i've basically just merged the 3 possible promise return types into one promise type with a union result type.
this allows async tasks submitted via the task manager to have both success and failure return branches; before this PR async tasks could only either always fail via return value, or always return success via return value and fail by throwing an exception - using task.error() (where task is the parameter given to task callbacks) was basically impossible in actual async applications.

i've also added a typecheck-only test that verifies that submitting a non-deterministic async task is possible.
this test will never fail during npm run test checks, but may emit errors in npm run typecheck instead

πŸ“ Checklist

  • I have read the contribution guide.
  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@thetutlage thetutlage merged commit 91a3884 into poppinss:6.x Mar 12, 2025
4 of 6 checks passed
@thetutlage
Copy link
Member

Thanks πŸ‘

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 this pull request may close these issues.

Return typings of TaskCalback require an async task to either always succeed or always fail
2 participants