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

Elaborate on error handling #83

Open
poscat0x04 opened this issue Jan 29, 2023 · 1 comment
Open

Elaborate on error handling #83

poscat0x04 opened this issue Jan 29, 2023 · 1 comment

Comments

@poscat0x04
Copy link

Currently, the error type is just a wrapper around String and the functions do not have descriptions on how they might fail either. It would be nice to have some information on error handling.

@lucab
Copy link
Owner

lucab commented Feb 1, 2023

Thanks for the report.
Generally speaking errors can come from 1) a mix of several kernel syscalls, or 2) improper API usage.
The latter is more or less already documented directly on the helpers, see for example caps::clear() docstring which states It cannot manipulate Ambient or Bounding set of other processes. If it isn't discoverable, I'm happy to take suggestions/improvements.
The former is instead a non-exhaustive set, as it depends on the specific kernel runtime. Syscalls can fail in many different ways which also vary across kernel version and build-configuration. And a single Rust method can dispatch to several different syscalls internally, thus we don't expose raw errno.

Generally speaking errors from this library are meant to be human-consumed. I'm happy to add more context to improve that side, but I'm not going to try to map all possible errors into Rust variants due to the above points.
If you encountered some error condition that could be probed upfront, we can consider adding an helper to the runtime module.

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

2 participants