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

User friendly error messages from errno #6

Open
dhardy opened this issue Feb 1, 2018 · 3 comments
Open

User friendly error messages from errno #6

dhardy opened this issue Feb 1, 2018 · 3 comments

Comments

@dhardy
Copy link

dhardy commented Feb 1, 2018

Is there a way to get user-friendly messages (static str or other) from errno numbers? I can't see anything except to refer to the table in cloudabi.txt:209.

For comparison, see from_raw_os_error which uses sys::os::error_string, which uses strerror_r internally. It looks like CloudABI error codes don't match up with POSIX error codes so will you provide an equivalent?

@dhardy dhardy changed the title User friendly error messages User friendly error messages from errno Feb 1, 2018
@m-ou-se
Copy link
Member

m-ou-se commented Feb 1, 2018

@EdSchouten
Copy link
Member

Hi Diggory,

It's safe to pass error codes from the Rust bindings to from_raw_os_error(). On CloudABI, that function is also implemented using strerror(). Inside of CloudABI's C library we ensure that the error codes are defined to match up with the ones from cloudabi.txt:

https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/errno/errno.c

That said, maybe there is some elegant way to expose documentation strings in cloudabi.txt through the Rust bindings as well...? @m-ou-se thoughts?

@dhardy
Copy link
Author

dhardy commented Feb 1, 2018

Thanks for the quick response. I have no problem using from_raw_os_error in that case so I guess this is just a documentation issue.

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

3 participants