Skip to content

Commit 0d654e0

Browse files
committed
Remove panic
1 parent c8b0aec commit 0d654e0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/singledispatch/core.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ impl SingleDispatch {
186186
state.cache.clear();
187187
Ok(unbound_func)
188188
}
189-
Err(_) => panic!("Singledispatch mutex poisoned!"),
189+
Err(e) => Err(PyRuntimeError::new_err(format!(
190+
"Singledispatch mutex poisoned: {e}"
191+
))),
190192
}
191193
}
192194

@@ -267,7 +269,9 @@ impl SingleDispatch {
267269

268270
state.get_or_find_impl(py, cls)
269271
}
270-
Err(_) => panic!("Singledispatch mutex poisoned!"),
272+
Err(e) => Err(PyRuntimeError::new_err(format!(
273+
"Singledispatch mutex poisoned: {e}"
274+
))),
271275
}
272276
}
273277

@@ -286,7 +290,7 @@ impl SingleDispatch {
286290
.into_pyobject(py)
287291
{
288292
Ok(v) => Ok(v.into_py_any(py)?),
289-
Err(_) => Err(PyRuntimeError::new_err("")),
293+
Err(e) => Err(e),
290294
},
291295
}
292296
} else {

0 commit comments

Comments
 (0)