Create SSLError with library and reason from ssl_data codes This helper converts OpenSSL numeric error codes to Python SSLError exceptions with proper _library and _reason attributes by looking up the error strings in ssl_data tables, then delegates to create_ssl_error_with_reason. # Arguments `vm` - Virtual machine reference `lib` - OpenSSL library code (e.g., ERR_LIB_SSL = 20) `reason` - OpenS
(
vm: &VirtualMachine,
lib: i32,
reason: i32,
)
| 521 | /// # Returns |
| 522 | /// PyBaseExceptionRef with _library and _reason attributes set |
| 523 | fn create_ssl_error_from_codes( |
| 524 | vm: &VirtualMachine, |
| 525 | lib: i32, |
| 526 | reason: i32, |
| 527 | ) -> PyBaseExceptionRef { |
| 528 | // Look up error strings from ssl_data tables |
| 529 | let key = ssl_data::encode_error_key(lib, reason); |
| 530 | let reason_str = ssl_data::ERROR_CODES |
| 531 | .get(&key) |
| 532 | .copied() |
| 533 | .unwrap_or("unknown error"); |
| 534 | |
| 535 | let lib_str = ssl_data::LIBRARY_CODES |
| 536 | .get(&(lib as u32)) |
| 537 | .copied() |
| 538 | .unwrap_or("UNKNOWN"); |
| 539 | |
| 540 | // Delegate to create_ssl_error_with_reason for actual exception creation |
| 541 | Self::create_ssl_error_with_reason( |
| 542 | vm, |
| 543 | Some(lib_str), |
| 544 | reason_str, |
| 545 | format!("[SSL] {reason_str}"), |
| 546 | ) |
| 547 | } |
| 548 | |
| 549 | /// Convert to Python exception |
| 550 | pub fn into_py_err(self, vm: &VirtualMachine) -> PyBaseExceptionRef { |
nothing calls this directly
no test coverage detected