Compiler: something up with promise catch
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 23
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 17
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the compiler's promise handling and reproduce the two each($.data, get()...) examples from the issue. Trace whether catch receives the last-good state and whether its return value becomes the next state, then document and verify the intended then()/catch() behavior with examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100