I'm getting an error object back from my SQLite database. When I display it with console.log(err)
, I get:
{ records: { Error: SQLITE_ERROR: no such table: showcaseUsers errno: 1, code: 'SQLITE_ERROR' } }
Yet when I display it with JSON.stringify(err)
, I only get:
{"records":{"errno":1,"code":"SQLITE_ERROR"}}
I want to get the error message no such table: showcaseUsers
in a string.
The only way I have found how to do this is with this:
const errorText = console.log(data);
But this also outputs the data to the console, which is undesirable.
How can I either (1) stop console.log from outputting its content to the console, or else (2) get the error message in a string some other way?
NOTE: I am in Node at this point and not in a browser, so it doesn't seem that the answer at Capturing javascript console.log? is helpful.