cgroups-rs icon indicating copy to clipboard operation
cgroups-rs copied to clipboard

Error handling

Open fabalchemy opened this issue 2 years ago • 1 comments

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.

fabalchemy avatar Apr 06 '22 09:04 fabalchemy

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

/cc @jodh-intel @Tim-Zhang

liubin avatar Jun 07 '22 13:06 liubin