Skip to content

Commit

Permalink
fix(clickhouse-driver): Replace error cause with string formatting (#…
Browse files Browse the repository at this point in the history
…8977)

Error cause is not properly propagated in REST API, so use direct formatting for now
  • Loading branch information
mcheshkov authored Nov 21, 2024
1 parent 7b1f797 commit e948856
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/cubejs-clickhouse-driver/src/ClickHouseDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
const results = await resultSet.json<Record<string, unknown>>();
return results;
} catch (e) {
throw new Error(`Query failed; query id: ${queryId}, SQL: ${query}`, { cause: e });
// TODO replace string formatting with proper cause
throw new Error(`Query failed; cause: ${e}; query id: ${queryId}; SQL: ${query}`);
}
});
}
Expand Down Expand Up @@ -407,7 +408,8 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
};
} catch (e) {
await client.close();
throw new Error(`Stream query failed; query id: ${queryId}, SQL: ${query}`, { cause: e });
// TODO replace string formatting with proper cause
throw new Error(`Stream query failed; cause: ${e}; query id: ${queryId}; SQL: ${query}`);
}
}

Expand Down Expand Up @@ -551,7 +553,8 @@ export class ClickHouseDriver extends BaseDriver implements DriverInterface {
try {
await this.command(createTableSql);
} catch (e) {
throw new Error(`Error during create table: ${createTableSql}`, { cause: e });
// TODO replace string formatting with proper cause
throw new Error(`Create table failed; cause: ${e}; SQL: ${createTableSql}`);
}
}

Expand Down

0 comments on commit e948856

Please sign in to comment.