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

Error handling #76

Open
fabalchemy opened this issue Apr 6, 2022 · 1 comment
Open

Error handling #76

fabalchemy opened this issue Apr 6, 2022 · 1 comment
Labels
enhancement New feature or request needs-review

Comments

@fabalchemy
Copy link

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 :

cgroups-rs/src/cgroup.rs

Lines 63 to 65 in 1df6e7a

fn create(&self) {
if self.hier.v2() {
let _ret = create_v2_cgroup(self.hier.root(), &self.path);

pub fn build(self, hier: Box<dyn Hierarchy>) -> Cgroup {
let cg = Cgroup::new(hier, self.name);
let _ret = cg.apply(&self.resources);
cg
}

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
Copy link
Member

liubin commented Jun 7, 2022

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

/cc @jodh-intel @Tim-Zhang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-review
Projects
None yet
Development

No branches or pull requests

2 participants