kata-containers / cgroups-rs

Native Rust library for managing control groups under Linux
https://crates.io/crates/cgroups-rs
Other
116 stars 47 forks source link

Error handling #76

Open fabalchemy opened 2 years ago

fabalchemy commented 2 years ago

Which feature do you think can be improved? Error handling when performing fallible operations.

How can it be improved? Don't silently ignore Results and propagate them to the crate user.

Additional Information

Some examples : https://github.com/kata-containers/cgroups-rs/blob/1df6e7a26ec30c1d9bb1c4ce9c13189a1d4aa401/src/cgroup.rs#L63-L65 https://github.com/kata-containers/cgroups-rs/blob/1df6e7a26ec30c1d9bb1c4ce9c13189a1d4aa401/src/cgroup_builder.rs#L137-L141

Is there a rationale behind this design choice? I'd like to propose a PR to implement error propagation, which could be implemented behind a feature flag for backwards compatibility.

liubin commented 2 years ago

I'd prefer to raise the exceptions to the caller but not hide them inside cgroup-rs.

/cc @jodh-intel @Tim-Zhang