Improve error message
This commit is contained in:
parent
23ee592dae
commit
ed7be8a29b
@ -209,8 +209,13 @@ impl MockRow {
|
|||||||
T: ValueType,
|
T: ValueType,
|
||||||
{
|
{
|
||||||
if let Some(index) = index.as_str() {
|
if let Some(index) = index.as_str() {
|
||||||
T::try_from(self.values.get(index).unwrap().clone())
|
T::try_from(
|
||||||
.map_err(|e| DbErr::Type(e.to_string()))
|
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() {
|
} else if let Some(index) = index.as_usize() {
|
||||||
let (_, value) = self.values.iter().nth(*index).ok_or_else(|| {
|
let (_, value) = self.values.iter().nth(*index).ok_or_else(|| {
|
||||||
DbErr::Query(RuntimeErr::Internal(format!(
|
DbErr::Query(RuntimeErr::Internal(format!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user