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

Compiler: something up with promise catch #886

Open
josephjclark opened this issue Feb 27, 2025 · 0 comments
Open

Compiler: something up with promise catch #886

josephjclark opened this issue Feb 27, 2025 · 0 comments

Comments

@josephjclark
Copy link
Collaborator

I confused myself over this today and it became a problem

I want to do this:

each($.data, get()
  .then(...)
  .catch(...)
)

Ie for each item, I call get(), and I do one thing if the request succeeds, and another thing if it fails.

But I think there's a problem on the catch, because it doesn't receive a state object. Or maybe it receives a wierd one? Or wait I think I'm catching an error on the .then() handler, not the get itself?

This also doesn't work:

each($.data, get()
  .catch(...)
  .then(...)
)

Because it'll catch the error and THEN trigger the .then(), which isn't what we want.

Something is up here, and the docs don't show an example of a .then() AND a .catch() on the same operation. Need to investigate, fix and clarify.

Also, while I'm here, need to ensure that catch receives the last-good-state (the state before the throw), and that whatever the catch returns is the next state going forward.

@github-project-automation github-project-automation bot moved this to New Issues in v2 Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New Issues
Development

No branches or pull requests

1 participant