Skip to content

Compiler: something up with promise catch #886

@josephjclark

Description

@josephjclark

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    DevX Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions