From e91e806054b5ecfccb951f6a63caf70d77ed2b54 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 2 Feb 2024 15:40:14 +0800 Subject: [PATCH] do not re-export and refine docs Signed-off-by: Bugen Zhao --- src/frontend/src/binder/bind_param.rs | 3 ++- .../src/catalog/system_catalog/mod.rs | 2 +- src/frontend/src/error.rs | 24 ++++++++++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/binder/bind_param.rs b/src/frontend/src/binder/bind_param.rs index ac2da925d6e3e..9d51947b35063 100644 --- a/src/frontend/src/binder/bind_param.rs +++ b/src/frontend/src/binder/bind_param.rs @@ -15,11 +15,12 @@ use bytes::Bytes; use pgwire::types::{Format, FormatIterator}; use risingwave_common::bail; +use risingwave_common::error::BoxedError; use risingwave_common::types::{Datum, ScalarImpl}; use super::statement::RewriteExprsRecursive; use super::BoundStatement; -use crate::error::{BoxedError, ErrorCode, Result}; +use crate::error::{ErrorCode, Result}; use crate::expr::{Expr, ExprImpl, ExprRewriter, Literal}; /// Rewrites parameter expressions to literals. diff --git a/src/frontend/src/catalog/system_catalog/mod.rs b/src/frontend/src/catalog/system_catalog/mod.rs index 544f28d479506..52462d9111ad9 100644 --- a/src/frontend/src/catalog/system_catalog/mod.rs +++ b/src/frontend/src/catalog/system_catalog/mod.rs @@ -26,6 +26,7 @@ use risingwave_common::catalog::{ ColumnCatalog, ColumnDesc, Field, SysCatalogReader, TableDesc, TableId, DEFAULT_SUPER_USER_ID, NON_RESERVED_SYS_CATALOG_ID, }; +use risingwave_common::error::BoxedError; use risingwave_common::row::OwnedRow; use risingwave_common::types::DataType; use risingwave_pb::meta::list_table_fragment_states_response::TableFragmentState; @@ -37,7 +38,6 @@ use crate::catalog::system_catalog::information_schema::*; use crate::catalog::system_catalog::pg_catalog::*; use crate::catalog::system_catalog::rw_catalog::*; use crate::catalog::view_catalog::ViewCatalog; -use crate::error::BoxedError; use crate::meta_client::FrontendMetaClient; use crate::scheduler::worker_node_manager::WorkerNodeManagerRef; use crate::session::AuthContext; diff --git a/src/frontend/src/error.rs b/src/frontend/src/error.rs index cdf82ea5a10ff..600ad08a41a01 100644 --- a/src/frontend/src/error.rs +++ b/src/frontend/src/error.rs @@ -1,6 +1,20 @@ +// Copyright 2024 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + use risingwave_batch::error::BatchError; use risingwave_common::array::ArrayError; -pub use risingwave_common::error::*; +use risingwave_common::error::{BoxedError, NoFunction, NotImplemented}; use risingwave_common::session_config::SessionConfigError; use risingwave_common::util::value_encoding::error::ValueEncodingError; use risingwave_connector::sink::SinkError; @@ -10,6 +24,13 @@ use risingwave_rpc_client::error::{RpcError, TonicStatusWrapper}; use thiserror::Error; use thiserror_ext::Box; +/// The error type for the frontend crate, acting as the top-level error type for the +/// entire RisingWave project. +// TODO(error-handling): this is migrated from the `common` crate, and there could +// be some further refactoring to do: +// - Some variants are never constructed. +// - Some variants store a type-erased `BoxedError` to resolve the reverse dependency. +// It's not necessary anymore as the error type is now defined at the top-level. #[derive(Error, Debug, Box)] #[thiserror_ext(newtype(name = RwError, backtrace, report_debug))] pub enum ErrorCode { @@ -144,6 +165,7 @@ pub enum ErrorCode { ), } +/// The result type for the frontend crate. pub type Result = std::result::Result; impl From for RwError {