Skip to content

io::reader should expose OS errors to users #2982

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

Closed
erickt opened this issue Jul 21, 2012 · 4 comments
Closed

io::reader should expose OS errors to users #2982

erickt opened this issue Jul 21, 2012 · 4 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@erickt
Copy link
Contributor

erickt commented Jul 21, 2012

io::reader's read_* functions need to expose a mechanism to report an underlying OS errors. Perhaps the read functions should return a result<..., ~str> or option<...>?

@eholk
Copy link
Contributor

eholk commented Jul 21, 2012

@graydon suggested an error handling system a while back that is very similar to LISP's condition system. If we end up adding that, would it be a better way to handle this? IO operations are common enough and errors rare enough that we may not want to have to surround every read with an alt to handle the error. On the other hand, this might encourage programmers to make more robust software.

@graydon
Copy link
Contributor

graydon commented Jul 21, 2012

Yeah, my intention is to sketch this out in this release cycle now that tls is in.

@brson
Copy link
Contributor

brson commented Apr 23, 2013

I've got a WIP on the new I/O system that overhauls error handling. It will use conditions in combination with 'nullable' return values (Option, empty vectors, sentinel values) and some clever trait implementations to hopefully provide an interface that isn't obnoxious to use while also providing error information and recoverability when it is desired. I'll have more details on the mailing list soon.

@pnkfelix
Copy link
Member

I believe brson was forward-referencing this mailing list message:

https://mail.mozilla.org/pipermail/rust-dev/2013-April/003746.html

which has a link to the core io::mod source that talks about error handling strategy:

https://github.com/brson/rust/blob/io/src/libstd/rt/io/mod.rs#L128

See also #6163. Actually, I am just going to close this as I think issue #6163 subsumes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

5 participants