Skip to content

Commit 32d3d36

Browse files
authored
fix: the problem of inconsistent error message returned when auto_create_table fails (#942)
## Related Issues Closes # ## Detailed Changes * Fix the problem of inconsistent error message returned when auto_create_table fails. * Grpc returns more detailed error info. ## Test Plan Manual test and CI.
1 parent ae44390 commit 32d3d36

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

proxy/src/error.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,13 @@ impl Error {
4343
/// Get the error message returned to the user.
4444
pub fn error_message(&self) -> String {
4545
match self {
46-
Error::ErrNoCause { msg, .. } => msg.clone(),
46+
Error::ErrNoCause { msg, .. } | Error::InternalNoCause { msg, .. } => msg.clone(),
4747

48-
Error::ErrWithCause { msg, source, .. } => {
48+
Error::ErrWithCause { msg, source, .. } | Error::Internal { msg, source, .. } => {
4949
let err_string = source.to_string();
5050
let first_line = error_util::remove_backtrace_from_err(&err_string);
5151
format!("{msg}. Caused by: {first_line}")
5252
}
53-
Error::Internal { msg, .. } | Error::InternalNoCause { msg, .. } => msg.clone(),
5453
}
5554
}
5655
}

proxy/src/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ impl<Q: QueryExecutor + 'static> Proxy<Q> {
279279

280280
let output = self
281281
.execute_plan(request_id, catalog, schema, plan, deadline)
282-
.await;
282+
.await?;
283283

284284
ensure!(
285-
matches!(output, Ok(Output::AffectedRows(_))),
285+
matches!(output, Output::AffectedRows(_)),
286286
ErrNoCause {
287287
code: StatusCode::INTERNAL_SERVER_ERROR,
288288
msg: "Invalid output type, expect AffectedRows, found Records",

0 commit comments

Comments
 (0)