this.analyticsServer
.queryPromise('SELECT * FROM visits LIMIT 10')
.then((rows) => {
// if specified format is any of JSON formats, rows is an array of all retrieved rows
// if not, then rows is the raw string result from clickhouse-server
})
.catch((err) => {
// called when an error occurred during query
});
In case of error (e.g. the table doesn't exist), in the catch block, err is always undefined.
This is because in queryPromise method, the error is catched and logged with this.__handlePromiseError(), that does not return anything, so the queryPromise just return reject(undefined).
Library version: 2.0.3 Node version: Irrelevant
From the example:
In case of error (e.g. the table doesn't exist), in the catch block, err is always undefined.
This is because in queryPromise method, the error is catched and logged with this.__handlePromiseError(), that does not return anything, so the queryPromise just return reject(undefined).
Possible fix: