Skip to content

Commit 85aeff2

Browse files
committed
Added one new exception for Runtime errors
Signed-off-by: chandr-andr (Kiselev Aleksandr) <[email protected]>
1 parent fca85b5 commit 85aeff2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/exceptions/python_errors.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ create_exception!(
4343
RustPSQLDriverPyBaseError
4444
);
4545

46+
create_exception!(
47+
psqlpy.exceptions,
48+
RustRuntimeJoinError,
49+
RustPSQLDriverPyBaseError
50+
);
51+
4652
create_exception!(psqlpy.exceptions, CursorError, RustPSQLDriverPyBaseError);
4753

4854
#[allow(clippy::missing_errors_doc)]
@@ -74,5 +80,9 @@ pub fn python_exceptions_module(py: Python<'_>, pymod: &Bound<'_, PyModule>) ->
7480
"MacAddr6ConversionError",
7581
py.get_type_bound::<MacAddr6ConversionError>(),
7682
)?;
83+
pymod.add(
84+
"RustRuntimeJoinError",
85+
py.get_type_bound::<MacAddr6ConversionError>(),
86+
)?;
7787
Ok(())
7888
}

src/exceptions/rust_errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ pub enum RustPSQLDriverError {
3737
UUIDConvertError(#[from] uuid::Error),
3838
#[error("Cannot convert provided string to MacAddr6")]
3939
MacAddr6ConversionError(#[from] macaddr::ParseError),
40-
#[error("Error: {0}")]
41-
BadPizedc(#[from] JoinError),
40+
#[error("Cannot execute future in Rust: {0}")]
41+
RuntimeJoinError(#[from] JoinError),
4242
}
4343

4444
impl From<RustPSQLDriverError> for pyo3::PyErr {
@@ -50,7 +50,7 @@ impl From<RustPSQLDriverError> for pyo3::PyErr {
5050
| RustPSQLDriverError::DBEnginePoolError(_)
5151
| RustPSQLDriverError::MacAddr6ConversionError(_)
5252
| RustPSQLDriverError::DBEngineBuildError(_)
53-
| RustPSQLDriverError::BadPizedc(_) => {
53+
| RustPSQLDriverError::RuntimeJoinError(_) => {
5454
RustPSQLDriverPyBaseError::new_err((error_desc,))
5555
}
5656
RustPSQLDriverError::RustToPyValueConversionError(_) => {

0 commit comments

Comments
 (0)