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

Allow only 1 attachment to a promise #440

Closed
beckje01 opened this issue Sep 9, 2014 · 3 comments
Closed

Allow only 1 attachment to a promise #440

beckje01 opened this issue Sep 9, 2014 · 3 comments
Assignees
Milestone

Comments

@beckje01
Copy link
Member

beckje01 commented Sep 9, 2014

Doing something like the following should not be allowed:

get { HttpClient httpClient ->
    def respPromise = httpClient.get {
        it.url.set(new URI("http://badsite.gas"))
    }

    respPromise.onError {
         //...
    }

    respPromise.then {
         //...
    }
}

We should error if you try to attach to the same promise twice.

@beckje01 beckje01 self-assigned this Sep 9, 2014
@beckje01 beckje01 changed the title Allow only 1 assignment to a promise Allow only 1 attachment to a promise Sep 9, 2014
@uris77
Copy link

uris77 commented Sep 11, 2014

What is the correct way to add an error handler? The intuitive thing to do, in my opinion, is something like what we have in javascript:

returnaPromise().then(funcA, errorFunc)

or:

returnAPromise().then(funcA).fail(erroFunc).done(funcB)

I feel like I'm missing something.

@ldaley
Copy link
Member

ldaley commented Sep 11, 2014

Use promise.onError().then().

@uris77
Copy link

uris77 commented Sep 11, 2014

Ah, thanks. I was doing it the wrong way: promise.then().onError()

@ldaley ldaley closed this as completed in 69c4f62 Sep 11, 2014
@ldaley ldaley assigned ldaley and unassigned beckje01 Sep 11, 2014
@ldaley ldaley added this to the release-0.9.9 milestone Sep 11, 2014
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

No branches or pull requests

3 participants