question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

second argument for .tap or similar method for rejections

See original GitHub issue

I often use .tap(console.log) for quick debugging. It would be useful for me to have it either work like .then so I could do .tap(null, console.log) as well to log rejections. Or to have a similar method that works like .tap but is analog to .catch as in .tapRejection(console.log).

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:31 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ajoslincommented, Jan 30, 2016

I’ve also got a legitimate production usecase: maintaining the lifecycle of a transaction for running sql queries.

Currently I have to do this:

var transaction = sql.transaction()
return action1(transaction)
  .then(() => action2(transaction))
  .then(transaction.commit)
  .catch(function (error) {
    transaction.rollback()
    return Promise.reject(error)
  })

I would prefer to do this:

var transaction = sql.transaction()
return action1(transaction)
  .then(() => action2(transaction))
  .then(transaction.commit)
  .tap(null, transaction.rollback)

Of course, a tapError function would be even better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Logical Fallacy & When to Reject an Argument
First, formal fallacies contain a flaw in their logical structure, while informal fallacies contain a flaw in their premises. Second, formal ...
Read more >
.tap | bluebird
If/when the returned promise is/becomes rejected, the promise returned from .tap is rejected with the same reason as the returned promise. In other...
Read more >
5 Reasons Why Your Patent Application Gets Rejected
#2.​​ The number two reason why a patent application gets rejected is that you tried to get broad protection for your invention. That's...
Read more >
How to respond to and overcome a Section 101 Rejection ...
This section explains how one might overcome an Alice (Section 101) rejection in a patent office action, such as an abstract idea rejection....
Read more >
Asserts - Node Tap
Asserts. The Test object has a collection of assertion methods. All assertion methods take optional message and extra arguments as the last two...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found