-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
BREAKING(ext/net): improved error code accuracy #25383
BREAKING(ext/net): improved error code accuracy #25383
Conversation
d74412c
to
39eb431
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ext/net/ops_unix.rs
Outdated
.map_err(|_| bad_resource("Listener has been closed"))?; | ||
.map_err(|_| { | ||
std::io::Error::new( | ||
std::io::ErrorKind::Interrupted, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interrupted is not really an appropriate error code in this case. Do you have something like Aborted ?
The reason is that EINTR is used very specifically for cases where a syscall is interrupted by a signal and should be retried. That semantic spills over into rust, as per the docs:
This operation was interrupted.
Interrupted operations can typically be retried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You suggested to use Interrupted
here: #13075 (comment). We do not have an Aborted
error.
I can introduce a new Closed
error, and use that everywhere we throw a BadResource
error - BadResource
is not descriptive anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closed
seems reasonable - BadResource
is a catch-all that is completely non-descriptive to users. Maybe we could make Closed extends BadResource
to limit the impact as there are a lot of checks for Deno.errors.BadResource
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this offline: we're reverting back to BadResource
to behave like the EBADF
that libuv returns in this case. We are keeping the Busy
changes though.
39eb431
to
f7e71b1
Compare
Fixes #13086