-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(error): eliminate most RwError
usages in common
crate
#13588
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ use risingwave_pb::plan_common::{PbColumnCatalog, PbColumnDesc}; | |
|
||
use super::row_id_column_desc; | ||
use crate::catalog::{cdc_table_name_column_desc, offset_column_desc, Field, ROW_ID_COLUMN_ID}; | ||
use crate::error::ErrorCode; | ||
use crate::types::DataType; | ||
|
||
/// Column ID is the unique identifier of a column in a table. Different from table ID, column ID is | ||
|
@@ -161,24 +160,6 @@ impl ColumnDesc { | |
descs | ||
} | ||
|
||
/// Find `column_desc` in `field_descs` by name. | ||
pub fn field(&self, name: &String) -> crate::error::Result<(ColumnDesc, i32)> { | ||
if let DataType::Struct { .. } = self.data_type { | ||
for (index, col) in self.field_descs.iter().enumerate() { | ||
if col.name == *name { | ||
return Ok((col.clone(), index as i32)); | ||
} | ||
} | ||
Err(ErrorCode::ItemNotFound(format!("Invalid field name: {}", name)).into()) | ||
} else { | ||
Err(ErrorCode::ItemNotFound(format!( | ||
"Cannot get field from non nested column: {}", | ||
self.name | ||
)) | ||
.into()) | ||
} | ||
} | ||
|
||
Comment on lines
-164
to
-181
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a dead method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I don't find any references. |
||
pub fn new_atomic(data_type: DataType, name: &str, column_id: i32) -> Self { | ||
Self { | ||
data_type, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[source]
will generateFrom<ExitStatusError>
forJeprofError
right? But how arestdout
andstderr
set?Does this work because of
thiserror_ext::ContextInto
which generatesinto_exit_error
which will retain the source error asinner
and set the arguments forstdout
andstderr
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly! I'll refine the documentation of
thiserror_ext
once it gets more stable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not accurate. Only
#[from]
will generateFrom
impl, while#[source]
only helps us to correctly maintain the source chain withsource()
method.