async testConnection() { try { return await this.pool.query('SELECT $1::int AS number', ['1']); } catch (e) { if (e.toString().indexOf('no pg_hba.conf entry for host') !== -1) { throw new Error(`Please use CUBEJS_DB_SSL=true to connect: ${e.toString()}`); } throw e; } }
config.$npm.connect.pool(ctx, dbThis) .then(db => { ctx.connect(db); return config.$npm.query.call(self, ctx, query, values, qrm); }) .then(data => { ctx.disconnect(); return data; }) .catch(error => { ctx.disconnect(); return $p.reject(error); })