Skip to content

Commit

Permalink
fix: add missing error display message
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia committed Nov 22, 2023
1 parent 4c76d4d commit e36c2ff
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 70 deletions.
4 changes: 2 additions & 2 deletions src/catalog/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub enum Error {
source: table::error::Error,
},

#[snafu(display(""))]
#[snafu(display("Internal error"))]
Internal {
location: Location,
source: BoxedError,
Expand Down Expand Up @@ -216,7 +216,7 @@ pub enum Error {
#[snafu(display("Illegal access to catalog: {} and schema: {}", catalog, schema))]
QueryAccessDenied { catalog: String, schema: String },

#[snafu(display(""))]
#[snafu(display("DataFusion error"))]
Datafusion {
#[snafu(source)]
error: DataFusionError,
Expand Down
2 changes: 1 addition & 1 deletion src/common/recordbatch/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum Error {
location: Location,
},

#[snafu(display(""))]
#[snafu(display("Failed to poll result stream"))]
PollStream {
#[snafu(source)]
error: datafusion::error::DataFusionError,
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum Error {
source: common_meta::error::Error,
},

#[snafu(display(""))]
#[snafu(display("External error"))]
External {
location: Location,
source: BoxedError,
Expand Down Expand Up @@ -170,7 +170,7 @@ pub enum Error {
source: query::error::Error,
},

#[snafu(display(""))]
#[snafu(display("Operation to region server failed"))]
InvokeRegionServer {
location: Location,
source: servers::error::Error,
Expand Down
2 changes: 1 addition & 1 deletion src/query/src/datafusion/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use snafu::{Location, Snafu};
#[snafu(visibility(pub))]
#[stack_trace_debug]
pub enum InnerError {
#[snafu(display(""))]
#[snafu(display("DataFusion error"))]
Datafusion {
#[snafu(source)]
error: DataFusionError,
Expand Down
4 changes: 2 additions & 2 deletions src/query/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub enum Error {
location: Location,
},

#[snafu(display(""))]
#[snafu(display("DataFusion error"))]
DataFusion {
#[snafu(source)]
error: DataFusionError,
Expand All @@ -140,7 +140,7 @@ pub enum Error {
source: sql::error::Error,
},

#[snafu(display(""))]
#[snafu(display("Failed to plan SQL"))]
PlanSql {
#[snafu(source)]
error: DataFusionError,
Expand Down
2 changes: 1 addition & 1 deletion src/script/src/python/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub enum Error {
error: ArrowError,
},

#[snafu(display(""))]
#[snafu(display("DataFusion error"))]
DataFusion {
location: SnafuLocation,
#[snafu(source)]
Expand Down
13 changes: 8 additions & 5 deletions src/servers/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,12 @@ pub enum Error {
source: crate::http::pprof::nix::Error,
},

#[snafu(display(""))]
Metrics { source: BoxedError },
#[snafu(display("Failed to update jemalloc metrics"))]
UpdateJemallocMetrics {
#[snafu(source)]
error: tikv_jemalloc_ctl::Error,
location: Location,
},

#[snafu(display("DataFrame operation error"))]
DataFrame {
Expand Down Expand Up @@ -408,7 +412,8 @@ impl ErrorExt for Error {
| TcpIncoming { .. }
| CatalogError { .. }
| GrpcReflectionService { .. }
| BuildHttpResponse { .. } => StatusCode::Internal,
| BuildHttpResponse { .. }
| UpdateJemallocMetrics { .. } => StatusCode::Internal,

CollectRecordbatch { .. } => StatusCode::EngineExecuteQuery,

Expand Down Expand Up @@ -479,8 +484,6 @@ impl ErrorExt for Error {
#[cfg(feature = "pprof")]
DumpPprof { source, .. } => source.status_code(),

Metrics { source } => source.status_code(),

ConvertScalarValue { source, .. } => source.status_code(),

ToJson { .. } => StatusCode::Internal,
Expand Down
5 changes: 2 additions & 3 deletions src/servers/src/metrics/jemalloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

mod error;

use common_telemetry::error;
use error::UpdateJemallocMetricsSnafu;
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use prometheus::*;
use snafu::ResultExt;
use tikv_jemalloc_ctl::stats::{allocated_mib, resident_mib};
use tikv_jemalloc_ctl::{epoch, epoch_mib, stats};

use crate::error::UpdateJemallocMetricsSnafu;

lazy_static! {
pub static ref SYS_JEMALLOC_RESIDEN: IntGauge = register_int_gauge!(
"sys_jemalloc_resident",
Expand Down
52 changes: 0 additions & 52 deletions src/servers/src/metrics/jemalloc/error.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/table/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub type Result<T> = std::result::Result<T, Error>;
#[snafu(visibility(pub))]
#[stack_trace_debug]
pub enum Error {
#[snafu(display(""))]
#[snafu(display("DataFusion error"))]
Datafusion {
#[snafu(source)]
error: DataFusionError,
Expand Down

0 comments on commit e36c2ff

Please sign in to comment.