Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Jan 10, 2023
1 parent 23ee592 commit ed7be8a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/database/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,13 @@ impl MockRow {
T: ValueType,
{
if let Some(index) = index.as_str() {
T::try_from(self.values.get(index).unwrap().clone())
.map_err(|e| DbErr::Type(e.to_string()))
T::try_from(
self.values
.get(index)
.unwrap_or_else(|| panic!("No column for ColIdx {:?}", index))
.clone(),
)
.map_err(|e| DbErr::Type(e.to_string()))
} else if let Some(index) = index.as_usize() {
let (_, value) = self.values.iter().nth(*index).ok_or_else(|| {
DbErr::Query(RuntimeErr::Internal(format!(
Expand Down

0 comments on commit ed7be8a

Please sign in to comment.