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

add tapError #1220

Merged
merged 7 commits into from Mar 3, 2017

Conversation

Projects
None yet
5 participants
@benjamingr
Collaborator

benjamingr commented Aug 31, 2016

Adds Promise.prototype.tapError to bluebird.

The tests for the predicate version aren't passing yet (not sure why) and the doc is still missing, will hopefully follow up with those before I run out of momentum.

@joepie91

This comment has been minimized.

Show comment
Hide comment
@joepie91

joepie91 Aug 31, 2016

Hmm. Is this meant to be equivalent to .error or to .catch?

joepie91 commented Aug 31, 2016

Hmm. Is this meant to be equivalent to .error or to .catch?

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Aug 31, 2016

Owner

There should also be cancellation tests, see how .tap is tested in test/cancel.js

Owner

petkaantonov commented Aug 31, 2016

There should also be cancellation tests, see how .tap is tested in test/cancel.js

Show outdated Hide outdated src/finally.js
@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Aug 31, 2016

Collaborator

Hmm. Is this meant to be equivalent to .error or to .catch?

To .catch (both the catch all variant and the filtered one.

Collaborator

benjamingr commented Aug 31, 2016

Hmm. Is this meant to be equivalent to .error or to .catch?

To .catch (both the catch all variant and the filtered one.

@joepie91

This comment has been minimized.

Show comment
Hide comment
@joepie91

joepie91 Aug 31, 2016

To .catch (both the catch all variant and the filtered one.

Hmm, shouldn't we name it .tapCatch then? Otherwise, I can see this causing some confusion for users, thinking that it's equivalent to .error.

joepie91 commented Aug 31, 2016

To .catch (both the catch all variant and the filtered one.

Hmm, shouldn't we name it .tapCatch then? Otherwise, I can see this causing some confusion for users, thinking that it's equivalent to .error.

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Sep 1, 2016

Owner

Yeah tapCatch is probably a better name for this

Owner

petkaantonov commented Sep 1, 2016

Yeah tapCatch is probably a better name for this

@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Sep 1, 2016

Collaborator
  • Renaming to catch.
  • Fixing the doc issues.
  • I don't see tap in the cancellation tests.
  • Using the same NEXT_FILTER.

Predicates still don't work, PTAL.

Collaborator

benjamingr commented Sep 1, 2016

  • Renaming to catch.
  • Fixing the doc issues.
  • I don't see tap in the cancellation tests.
  • Using the same NEXT_FILTER.

Predicates still don't work, PTAL.

Show outdated Hide outdated src/finally.js
Show outdated Hide outdated src/finally.js
@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Sep 1, 2016

Owner

I don't see tap in the cancellation tests.

never mind then, remembered wrong

Owner

petkaantonov commented Sep 1, 2016

I don't see tap in the cancellation tests.

never mind then, remembered wrong

@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Sep 1, 2016

Collaborator

@petkaantonov do we really need to support the multi parameter syntax? I'm fine with just supporting .tapCatch(e => {}) and .tapCatch(type|predicate, e => {})

Collaborator

benjamingr commented Sep 1, 2016

@petkaantonov do we really need to support the multi parameter syntax? I'm fine with just supporting .tapCatch(e => {}) and .tapCatch(type|predicate, e => {})

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Sep 1, 2016

Owner

No but the predicate should still be type checked at this point, otherwise confusing error will happen at some later point

Owner

petkaantonov commented Sep 1, 2016

No but the predicate should still be type checked at this point, otherwise confusing error will happen at some later point

@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Sep 1, 2016

Collaborator

Addressed the feedback but predicate tests still don't pass.

Collaborator

benjamingr commented Sep 1, 2016

Addressed the feedback but predicate tests still don't pass.

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Sep 1, 2016

Owner

The finallyHandler needs to be modified to:

if (ret === NEXT_FILTER) {
    return ret;
} else if (ret !== undefined) {
    ...
Owner

petkaantonov commented Sep 1, 2016

The finallyHandler needs to be modified to:

if (ret === NEXT_FILTER) {
    return ret;
} else if (ret !== undefined) {
    ...
@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Sep 1, 2016

Collaborator

Still no dice

Collaborator

benjamingr commented Sep 1, 2016

Still no dice

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Sep 1, 2016

Owner

Run it individually to see the reason for failure node tools/test --run=tapCatch, for instance you have typed RefernceError instead of ReferenceError in one of the predicate tests

Owner

petkaantonov commented Sep 1, 2016

Run it individually to see the reason for failure node tools/test --run=tapCatch, for instance you have typed RefernceError instead of ReferenceError in one of the predicate tests

@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr

benjamingr Sep 1, 2016

Collaborator

I did, that's not why it's failing. I see an assertionError, I don't really understand catchFilter very well - any chance you could take a look tonight before you release and see what I did wrong?

Collaborator

benjamingr commented Sep 1, 2016

I did, that's not why it's failing. I see an assertionError, I don't really understand catchFilter very well - any chance you could take a look tonight before you release and see what I did wrong?

@benjamingr

This comment has been minimized.

Show comment
Hide comment
@benjamingr
Collaborator

benjamingr commented Sep 9, 2016

Show outdated Hide outdated src/finally.js
@Retsam

This comment has been minimized.

Show comment
Hide comment
@Retsam

Retsam Feb 27, 2017

Contributor

I'd love to see this feature go in; I've opened #1351 as an extension of this PR with my fixes for most of the above issues. (Still need to add type checking for predicates)

Contributor

Retsam commented Feb 27, 2017

I'd love to see this feature go in; I've opened #1351 as an extension of this PR with my fixes for most of the above issues. (Still need to add type checking for predicates)

Fixes to tapError implementation/tests (#1351)
* Fix typo: ReferneceError -> ReferenceError

* Fix typo: promsie -> promise

* s/tapError/tapCatch/g

* Pass an array of predicates to catchFilter in tapCatch

* Fix tapCatch tests

* Add support for multiple predicates and predicate type checking

@petkaantonov petkaantonov merged commit 053d02e into master Mar 3, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@petkaantonov petkaantonov deleted the add-tapErrr branch Mar 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment