Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easy to convert Rust error types to Python exceptions #21

Closed
messense opened this issue Jun 7, 2017 · 0 comments
Closed

Make it easy to convert Rust error types to Python exceptions #21

messense opened this issue Jun 7, 2017 · 0 comments

Comments

@messense
Copy link
Member

messense commented Jun 7, 2017

error[E0277]: the trait bound `pyo3::PyErr: std::convert::From<std::io::Error>` is not satisfied
  --> src/lib.rs:11:17
   |
11 |     let mut f = fs::File::open(path)?;
   |                 ^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<std::io::Error>` is not implemented for `pyo3::PyErr`
   |
   = help: the following implementations were found:
             <pyo3::PyErr as std::convert::From<pyo3::PyDowncastError<'p>>>
   = note: required by `std::convert::From::from`

This is annoying, makes it hard to use try! or ?. We could implement From trait for some of the Rust error types like std::io::Error.

@messense messense changed the title implemented From to make it easy to convert Rust error types to Python exceptions Make it easy to convert Rust error types to Python exceptions Jun 7, 2017
@messense messense closed this as completed Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant