Skip to content

Commit adec2dc

Browse files
authored
Improve displayed error by using DataFusionError's Display trait (#1370)
* Use instead of for * update test
1 parent f72e549 commit adec2dc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

python/tests/test_indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_err(df):
4343
with pytest.raises(Exception) as e_info:
4444
df["c"]
4545

46-
for e in ["SchemaError", "FieldNotFound", 'name: "c"']:
46+
for e in ["Schema error", "No field named c"]:
4747
assert e in e_info.value.args[0]
4848

4949
with pytest.raises(Exception) as e_info:

python/tests/test_udf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,4 @@ def non_nullable_abs(input_col):
207207

208208
with pytest.raises(Exception) as e_info:
209209
_results = df_result.collect()
210-
assert "InvalidArgumentError" in str(e_info)
210+
assert "Invalid argument error" in str(e_info)

src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub enum PyDataFusionError {
3939
impl fmt::Display for PyDataFusionError {
4040
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
4141
match self {
42-
PyDataFusionError::ExecutionError(e) => write!(f, "DataFusion error: {e:?}"),
42+
PyDataFusionError::ExecutionError(e) => write!(f, "DataFusion error: {e}"),
4343
PyDataFusionError::ArrowError(e) => write!(f, "Arrow error: {e:?}"),
4444
PyDataFusionError::PythonError(e) => write!(f, "Python error {e:?}"),
4545
PyDataFusionError::Common(e) => write!(f, "{e}"),

0 commit comments

Comments
 (0)