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.

then warning creates messy logs for thenable APIs

See original GitHub issue

The recent addition of warnings when then is called with a non function argument is creating messy test output over at Knex. The basic issue here is that query objects are thenables that proxy to a real promise which gets created. Since Promise.longStackTraces turns on debugging, we’re getting loads of warnings about empty thens in the integration tests.

The easy fix here is just to revert the warning, but I understand if there was a compelling reason to do it. We could also use promise.then.apply(promise, arguments) in place of explicitly passing the two callbacks to promise.then. I’d prefer not to go that route since it’s harder to read/understand.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
petkaantonovcommented, Feb 4, 2015

@bendrucker You could just call ._then? It’s forced to retain same api signature across all versions, even major.

btw In 3.0 warnings are disabled/enabled with

Promise.config({
     warnings: false,
     longStackTraces: true
});

Note that .then() doesn’t cause a warning, in fact it’s used internally many times. Warning is only given when you explicitly pass value(s) that are all non-functions.

0reactions
bendruckercommented, Feb 8, 2015

Fair enough. I’ve fixed it in knex.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise.prototype.then() - JavaScript - MDN Web Docs
The then() method of a Promise object takes up to two arguments: callback functions for the fulfilled and rejected cases of the Promise....
Read more >
How do I convert an existing callback API to promises?
Does creating a new Promise add any significant overhead? I'm wanting to wrap all my synchronous Noje.js functions in a Promise so as...
Read more >
Deprecated APIs | Node.js v19.3.0 Documentation
Deprecated APIs#. Node.js APIs might be deprecated for any of the following reasons: Use of the API is unsafe. An improved alternative API...
Read more >
VS Code API | Visual Studio Code Extension API
VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This page lists all...
Read more >
How to fix "The following module is missing from the file ...
If you see a PHP warning such as "The following module is missing from the file system. ... Rather than makes rules and...
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