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.

Verbose doesn't work with this library, it never did

See original GitHub issue

I was never able to make verbose work with this library, consider the following example :

const sqlite3 = require('sqlite3');
const { open } = require('sqlite');
sqlite3.verbose();

(async () => {
  const db = await open({
    filename: ':memory:',
    driver: sqlite3.Database
  });

  db.run('select * from non_existent_table').catch(err => {
    console.log('promise rejected ...')
    throw err;
  });
})()

It’s a very basic example, but the error throws doesn’t have any trace info :

$ node app
promise rejected ...
(node:14036) UnhandledPromiseRejectionWarning: Error: SQLITE_ERROR: no such table: non_existent_table
(node:14036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I first thought it was a bug, I forked the repo and tried to solve it, but it turned out it’s not possible from this library because node-sqlite3 adds the trace info by catching an error you should throw, and throwing it instead of reject() causes the promise to never reject because an error thrown in an async callback cannot be caught by the promise.

I then sent an issue and a PR to fix it in node-sqlite3 repo.

I opened this issue here for anyone trying to figure out why it’s not working with node-sqlite, please keep it open until the problem is fixed in the other repo, if it’s not accepted there then update the docs so no one loses his mind trying to figure out the problem.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
theogravitycommented, Jan 10, 2021

v5.0.0 of node-sqlite3 is now released.

You really should explicitly say in README.md that node-sqlite supports v5.

Not sure why this is important? Unless there’s a v6 and there’s some incompat issue that can’t be addressed. So far the recent versions of sqlite3 haven’t had bc issues that I’d figure most people will generally use the latest version of sqlite3.

1reaction
mmghvcommented, Jul 1, 2020

v5.0.0 of node-sqlite3 is now released.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Verbose doesn't work with pormises · Issue #1316 - GitHub
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >
VC++ 2010 Linker /VERBOSE option doesn't work?
It is a VC++ 2010 project. I know that it works fine, and I was able to produce some output that I was...
Read more >
Mkldnn verbose doesn't work - Questions - Apache TVM Discuss
Hi. I have a question about USE_MKLDNN. My build options : LLVM ON, BLAS none, USE_MKL /opt/intel/mkl, USE_MKLDNN ON Even though I set...
Read more >
Troubleshoot pipeline runs - Azure DevOps - Microsoft Learn
In this article. Pipeline won't trigger; Pipeline queues but never gets an agent; Pipeline fails to complete; Get logs to diagnose problems; I ......
Read more >
Clang linking error MacOS Big Sur | Apple Developer Forums
Hi All, I am trying to build my helloworld.cpp, but I am having problem since I updated to Big Sur. Below a verbose...
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