Skip to content

Commit

Permalink
revert anyhow newtype
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Feb 13, 2024
1 parent 6636d8e commit aeab5af
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 133 deletions.
29 changes: 20 additions & 9 deletions src/connector/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use risingwave_common::error::v2::def_anyhow_newtype;
use thiserror::Error;

def_anyhow_newtype! {
/// The error type for the `connector` crate.
///
/// We use [`anyhow::Error`] under the hood as the connector has to deal with
/// various kinds of errors from different external crates. It acts more like an
/// application and callers may not expect to handle it in a fine-grained way.
pub ConnectorError;
#[derive(Error, Debug)]
pub enum ConnectorError {
#[error("MySQL error: {0}")]
MySql(
#[from]
#[backtrace]
mysql_async::Error,
),

#[error("Postgres error: {0}")]
Postgres(#[from] tokio_postgres::Error),

#[error(transparent)]
Uncategorized(
#[from]
#[backtrace]
anyhow::Error,
),
}

pub type ConnectorResult<T> = std::result::Result<T, ConnectorError>;
pub type ConnectorResult<T> = Result<T, ConnectorError>;
123 changes: 0 additions & 123 deletions src/error/src/anyhow.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
#![feature(register_tool)]
#![register_tool(rw)]

pub mod anyhow;
pub mod tonic;

0 comments on commit aeab5af

Please sign in to comment.