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

Modify variables to detect websocket timeout errors #485

Closed
wants to merge 1 commit into from
Closed

Modify variables to detect websocket timeout errors #485

wants to merge 1 commit into from

Conversation

guonaihong
Copy link

@guonaihong guonaihong commented Feb 27, 2019

old--->cannot refer to unexported name websocket.netError

new--->

if err != nil {
    if opErr, ok := err.(*websocket.NetError); ok {
        if opErr.Timeout() {
                //checkout websocket timeout
        }
    }

}

old--->cannot refer to unexported name websocket.netError

new--->
if err != nil {
    if opErr, ok := err.(*websocket.NetError); ok {
        if opErr.Timeout() {
                //checkout websocket timeout
        }
    }

}
@garyburd
Copy link
Contributor

garyburd commented Feb 27, 2019

I do not want to export the netError type because the type will be removed when #474 is fixed.

The supported way to detect a timeout error is:

   if e, ok := err.(net.Error); ok & e.Timeout() {
         // it's a timeout 
   }

@garyburd garyburd closed this Feb 27, 2019
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

Successfully merging this pull request may close these issues.

2 participants