-
Notifications
You must be signed in to change notification settings - Fork 5
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
Proper C++ exception handling #10
Comments
Catching all C++ exceptions and translating them to a rust I notice some cruft which is apparently unused like the |
It seems as if I tried it and it correctly catches and converts a So I think we only have to add that Maybe also add a catch-all arm to be on the safe side. EDIT: I'll try it out on the system that makes trouble |
|
@astraw Can you please look at this, I'd need that fix in a project |
Ahh, yes, thanks for the ping. I was very busy with stuff but they are settling down and I should be able to look at this in the next couple of days. |
I have a problem with some code that has to reconfigure the exposure value after every grabbed image. To do this the grabbing must be stopped, value set, grabbing started...
The problem is, that occasionally the C++ code throws a
GenICam_3_1_Basler_pylon::RuntimeException
that can't be caught in rust and so my app panics.I looked at the code and it seems, although
fn float_node_set_value(node: &UniquePtr<CFloatParameter>, value: f64) -> Result<()>;
returns a Result, it seems it's not really created on errors (exceptions) in the FFI code.Wouldn't it make sense to try-catch all C++ FFI functions return a
Result::Err
value on exceptions to make the user handle the error in Rust-land?The text was updated successfully, but these errors were encountered: