diff --git a/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java b/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java index 6bfadb6..4b74a43 100755 --- a/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java +++ b/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java @@ -311,7 +311,7 @@ private void getResponse(int fn, BytesOutputStream out) throws IOException { } } catch (IOException e) { m_CommPort.disableReceiveThreshold(); - throw new IOException("getResponse serial port exception"); + throw e; } }// getResponse diff --git a/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java b/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java index c43eef3..12e7453 100755 --- a/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java +++ b/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java @@ -176,7 +176,8 @@ public ModbusRequest readRequest() throws ModbusIOException { throw new ModbusIOException(true); } catch (Exception ex) { // ex.printStackTrace(); - throw new ModbusIOException("I/O exception - failed to read."); + throw new ModbusIOException(String.format("I/O exception - failed to read: %s %s", + ex.getClass().getSimpleName(), ex.getMessage())); } }// readRequest