Skip to content

Commit

Permalink
fix(cubesql): More readable error message during SQL generation
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Feb 23, 2024
1 parent 7022611 commit d9a7194
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/cubejs-backend-native/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ impl TransportService for NodeBridgeTransport {
)
.await?;

if let Some(error) = response.get("error") {
if let Some(stack) = response.get("stack") {
return Err(CubeError::user(format!(
"Error during SQL generation: {}\n{}",
error, stack
)));
}
return Err(CubeError::user(format!(
"Error during SQL generation: {}",
error
)));
}

let sql = response
.get("sql")
.ok_or_else(|| CubeError::user(format!("No sql in response: {}", response)))?
Expand Down

0 comments on commit d9a7194

Please sign in to comment.