Merge pull request #3314 from panpilkarz/patch-1
Tiny grammar fix in error_handling.md
This commit is contained in:
commit
ec0f0d4051
|
@ -13,7 +13,7 @@ Rust code uses the generic [`Result<T, E>`] enum to propagate errors. The error
|
|||
PyO3 has the [`PyErr`] type which represents a Python exception. If a PyO3 API could result in a Python exception being raised, the return type of that `API` will be [`PyResult<T>`], which is an alias for the type `Result<T, PyErr>`.
|
||||
|
||||
In summary:
|
||||
- When Python exceptions are raised and caught by PyO3, the exception will stored in the `Err` variant of the `PyResult`.
|
||||
- When Python exceptions are raised and caught by PyO3, the exception will be stored in the `Err` variant of the `PyResult`.
|
||||
- Passing Python exceptions through Rust code then uses all the "normal" techniques such as the `?` operator, with `PyErr` as the error type.
|
||||
- Finally, when a `PyResult` crosses from Rust back to Python via PyO3, if the result is an `Err` variant the contained exception will be raised.
|
||||
|
||||
|
|
Loading…
Reference in New Issue