Skip to content

Commit

Permalink
fix rest
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Feb 22, 2024
1 parent 08b44a8 commit de83917
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/frontend/planner_test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ pub async fn run_test_file(file_path: &Path, file_content: &str) -> Result<()> {
"Test #{i} (id: {}) failed, SQL:\n{}\nError: {}",
c.id().clone().unwrap_or_else(|| "<none>".to_string()),
c.sql(),
e
e.as_report()
);
failed_num += 1;
}
Expand Down
14 changes: 7 additions & 7 deletions src/meta/service/src/cloud_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl CloudService for CloudServiceImpl {
{
return Ok(new_rwc_validate_fail_response(
ErrorType::PrivatelinkResolveErr,
e.to_string(),
e.to_report_string(),
));
}
} else {
Expand All @@ -152,7 +152,7 @@ impl CloudService for CloudServiceImpl {
if let Err(e) = props {
return Ok(new_rwc_validate_fail_response(
ErrorType::KafkaInvalidProperties,
e.to_string(),
e.to_report_string(),
));
};

Expand All @@ -167,28 +167,28 @@ impl CloudService for CloudServiceImpl {
if let Err(e) = enumerator {
return Ok(new_rwc_validate_fail_response(
ErrorType::KafkaInvalidProperties,
e.to_string(),
e.to_report_string(),
));
}
if let Err(e) = enumerator.unwrap().list_splits().await {
let error_message = e.to_string();
let error_message = e.to_report_string();
if error_message.contains("BrokerTransportFailure") {
return Ok(new_rwc_validate_fail_response(
ErrorType::KafkaBrokerUnreachable,
e.to_string(),
e.to_report_string(),
));
}
static TOPIC_NOT_FOUND: LazyLock<Regex> =
LazyLock::new(|| Regex::new(r"topic .* not found").unwrap());
if TOPIC_NOT_FOUND.is_match(error_message.as_str()) {
return Ok(new_rwc_validate_fail_response(
ErrorType::KafkaTopicNotFound,
e.to_string(),
e.to_report_string(),
));
}
return Ok(new_rwc_validate_fail_response(
ErrorType::KafkaOther,
e.to_string(),
e.to_report_string(),
));
}
});
Expand Down
3 changes: 2 additions & 1 deletion src/meta/src/dashboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use axum::Router;
use hyper::Request;
use parking_lot::Mutex;
use risingwave_rpc_client::ComputeClientPool;
use thiserror_ext::AsReport;
use tower::{ServiceBuilder, ServiceExt};
use tower_http::add_extension::AddExtensionLayer;
use tower_http::cors::{self, CorsLayer};
Expand Down Expand Up @@ -455,7 +456,7 @@ impl DashboardService {
proxy::proxy(req, cache).await.or_else(|err| {
Ok((
StatusCode::INTERNAL_SERVER_ERROR,
format!("Unhandled internal error: {}", err),
err.context("Unhandled internal error").to_report_string(),
)
.into_response())
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl CoordinatorWorker {
.wait_for_writers(first_writer_request.vnode_bitmap)
.await
{
error!("failed to wait for all writers: {:?}", e);
error!(error = %e.as_report(), "failed to wait for all writers");
worker
.send_to_all_sink_writers(|| {
Err(Status::cancelled("failed to wait for all writers"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use std::time::Duration;

use anyhow::{anyhow, Result};
use risingwave_common::error::v2::AsReport;
use risingwave_simulation::cluster::{Cluster, Configuration, Session};
use tokio::time::sleep;

Expand Down Expand Up @@ -348,7 +349,7 @@ async fn test_high_barrier_latency_cancel(config: Configuration) -> Result<()> {
.run("CREATE MATERIALIZED VIEW mv1 as values(1)")
.await
{
tracing::info!("Recreate mv failed with {e:?}");
tracing::info!(error = %e.as_report(), "Recreate mv failed");
continue;
} else {
tracing::info!("recreated mv");
Expand Down

0 comments on commit de83917

Please sign in to comment.