then warning creates messy logs for thenable APIs
See original GitHub issueThe 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:
- Created 9 years ago
- Comments:12 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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
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.Fair enough. I’ve fixed it in knex.