mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-30 11:50:38 +00:00
refactor: remove macro define_opaque_error (#812)
* refactor: remove macro define_opaque_error Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * impl BoxedError Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * fix tests Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * remove open-region error Signed-off-by: Ruihang Xia <waynestxia@gmail.com> Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -227,20 +227,21 @@ pub fn get_error_reason_loc(err: &Error) -> (String, Option<Location>) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use common_error::mock::MockError;
|
||||
use snafu::ResultExt;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn throw_query_error() -> query::error::Result<()> {
|
||||
let mock_err = MockError::with_backtrace(StatusCode::TableColumnNotFound);
|
||||
Err(query::error::Error::new(mock_err))
|
||||
query::error::TableNotFoundSnafu {
|
||||
table: String::new(),
|
||||
}
|
||||
.fail()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_error() {
|
||||
let err = throw_query_error().context(DatabaseQuerySnafu).unwrap_err();
|
||||
assert_eq!(StatusCode::TableColumnNotFound, err.status_code());
|
||||
assert_eq!(StatusCode::InvalidArguments, err.status_code());
|
||||
assert!(err.backtrace_opt().is_some());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user