public static TransportErrorCode fromWebSocket ( int code ) { TransportErrorCode builtIn = WEBSOCKET_ERROR_CODE_MAP . get ( code ) ; if ( builtIn == null ) { if ( code < 0 || code > 65535 ) { throw new IllegalArgumentException ( "Invalid WebSocket status code: " + code ) ; } else if ( code >= 4400 && code <= 4599 ) { return new TransportErrorCode ( code - 4000 , code , "Unknown error code" ) ; } else { return new TransportErrorCode ( 404 , code , "Unknown error code" ) ; } } else { return builtIn ; } }
Get a transport error code from the given WebSocket close code .