Skip to content

Commit 5401f80

Browse files
committed
core/incremental: Improve error handling in view.rs
1 parent b674a05 commit 5401f80

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

core/incremental/view.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,11 @@ impl IncrementalView {
548548
);
549549
// Only add if there's actually a condition for this table
550550
if let Some(condition) = table_specific_condition {
551-
let conditions = table_conditions.get_mut(table_name).unwrap();
551+
let conditions = table_conditions.get_mut(table_name).ok_or_else(|| {
552+
LimboError::InternalError(
553+
"table_conditions should have entry for table_name".to_string(),
554+
)
555+
})?;
552556
conditions.push(Some(condition));
553557
}
554558
}
@@ -558,7 +562,11 @@ impl IncrementalView {
558562
// explicitly, because the same table may appear in many conditions - some of which
559563
// have filters that would otherwise be applied.
560564
for table_name in table_map.keys() {
561-
let conditions = table_conditions.get_mut(table_name).unwrap();
565+
let conditions = table_conditions.get_mut(table_name).ok_or_else(|| {
566+
LimboError::InternalError(
567+
"table_conditions should have entry for table_name".to_string(),
568+
)
569+
})?;
562570
conditions.push(None);
563571
}
564572
}
@@ -1222,7 +1230,11 @@ impl IncrementalView {
12221230
match stmt.step()? {
12231231
crate::vdbe::StepResult::Row => {
12241232
// Get the row
1225-
let row = stmt.row().unwrap();
1233+
let row = stmt.row().ok_or_else(|| {
1234+
LimboError::InternalError(
1235+
"row should exist after StepResult::Row".to_string(),
1236+
)
1237+
})?;
12261238

12271239
// Extract values from the row
12281240
let all_values: Vec<crate::types::Value> =

0 commit comments

Comments
 (0)