Browse Source

Update for go 1.14 Wasm changes

pull/1422/head
M. Hawn 4 years ago
parent
commit
5a6d40c1ee
  1. 6
      p2p/transport/websocket/conn_browser.go

6
p2p/transport/websocket/conn_browser.go

@ -272,17 +272,17 @@ func arrayBufferToBytes(buffer js.Value) []byte {
func errorEventToError(val js.Value) error {
var typ string
if gotType := val.Get("type"); gotType != js.Undefined() {
if gotType := val.Get("type"); !gotType.Equal(js.Undefined()) {
typ = gotType.String()
} else {
typ = val.Type().String()
}
var reason string
if gotReason := val.Get("reason"); gotReason != js.Undefined() && gotReason.String() != "" {
if gotReason := val.Get("reason"); !gotReason.Equal(js.Undefined()) && gotReason.String() != "" {
reason = gotReason.String()
} else {
code := val.Get("code")
if code != js.Undefined() {
if !code.Equal(js.Undefined()) {
switch code := code.Int(); code {
case 1006:
reason = "code 1006: connection unexpectedly closed"

Loading…
Cancel
Save