diff --git a/lib/db/clickhouse.js b/lib/db/clickhouse.js index a704fe5f..02596b42 100644 --- a/lib/db/clickhouse.js +++ b/lib/db/clickhouse.js @@ -1353,13 +1353,18 @@ const samplesReadTable = { * @param config {Object?} * @returns {Promise>} */ -const rawRequest = (query, data, database, config) => { - const getParams = [ - (database ? `database=${encodeURIComponent(database)}` : null), - (data ? `query=${encodeURIComponent(query)}` : null) - ].filter(p => p) - const url = `${getClickhouseUrl()}/${getParams.length ? `?${getParams.join('&')}` : ''}` - return axios.post(url, data || query, config) +const rawRequest = async (query, data, database, config) => { + try { + const getParams = [ + (database ? `database=${encodeURIComponent(database)}` : null), + (data ? `query=${encodeURIComponent(query)}` : null) + ].filter(p => p) + const url = `${getClickhouseUrl()}/${getParams.length ? `?${getParams.join('&')}` : ''}` + return await axios.post(url, data || query, config) + } catch (e) { + logger.error('rawRequest error: ' + query) + throw e + } } /**