Skip to content

Commit 95fafa7

Browse files
committed
fix: Log errors correctly in utils
1 parent f9efa6e commit 95fafa7

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

native/ecto_libsql/src/utils.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,30 @@ pub async fn collect_rows<'a>(env: Env<'a>, mut rows: Rows) -> Result<Term<'a>,
223223
}
224224
None => {
225225
// Binary allocation failed - return error atom
226+
eprintln!(
227+
"WARNING: Failed to allocate binary for column '{}' (index {})",
228+
column_names
229+
.get(i as usize)
230+
.unwrap_or(&"unknown".to_string()),
231+
i
232+
);
226233
crate::constants::error().encode(env)
227234
}
228235
},
229236
Ok(Value::Null) => nil().encode(env),
230-
Err(_) => nil().encode(env),
237+
Err(err) => {
238+
// Log the error with context to aid debugging
239+
eprintln!(
240+
"WARNING: Failed to read column '{}' (index {}): {}",
241+
column_names
242+
.get(i as usize)
243+
.unwrap_or(&"unknown".to_string()),
244+
i,
245+
err
246+
);
247+
// Return error atom instead of nil to surface the issue
248+
crate::constants::error().encode(env)
249+
}
231250
};
232251
row_terms.push(term);
233252
}

0 commit comments

Comments
 (0)