Skip to content

Commit 53b4a31

Browse files
committed
core/incremental: Improve error handling in view.rs
1 parent bfe19d9 commit 53b4a31

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
@@ -547,7 +547,11 @@ impl IncrementalView {
547547
);
548548
// Only add if there's actually a condition for this table
549549
if let Some(condition) = table_specific_condition {
550-
let conditions = table_conditions.get_mut(table_name).unwrap();
550+
let conditions = table_conditions.get_mut(table_name).ok_or_else(|| {
551+
LimboError::InternalError(
552+
"table_conditions should have entry for table_name".to_string(),
553+
)
554+
})?;
551555
conditions.push(Some(condition));
552556
}
553557
}
@@ -557,7 +561,11 @@ impl IncrementalView {
557561
// explicitly, because the same table may appear in many conditions - some of which
558562
// have filters that would otherwise be applied.
559563
for table_name in table_map.keys() {
560-
let conditions = table_conditions.get_mut(table_name).unwrap();
564+
let conditions = table_conditions.get_mut(table_name).ok_or_else(|| {
565+
LimboError::InternalError(
566+
"table_conditions should have entry for table_name".to_string(),
567+
)
568+
})?;
561569
conditions.push(None);
562570
}
563571
}
@@ -1221,7 +1229,11 @@ impl IncrementalView {
12211229
match stmt.step()? {
12221230
crate::vdbe::StepResult::Row => {
12231231
// Get the row
1224-
let row = stmt.row().unwrap();
1232+
let row = stmt.row().ok_or_else(|| {
1233+
LimboError::InternalError(
1234+
"row should exist after StepResult::Row".to_string(),
1235+
)
1236+
})?;
12251237

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

0 commit comments

Comments
 (0)