diff --git a/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/BluetoothConnection.java b/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/BluetoothConnection.java index 14db1d2..7f86d8e 100644 --- a/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/BluetoothConnection.java +++ b/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/BluetoothConnection.java @@ -87,7 +87,7 @@ public Flowable observeByteStream() { subscriber.onNext((byte) inputStream.read()); } catch (IOException e) { connected = false; - subscriber.onError(new ConnectionClosedException("Can't read stream")); + subscriber.onError(new ConnectionClosedException("Can't read stream", e)); } finally { if (!connected) { closeConnection(); diff --git a/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/exceptions/ConnectionClosedException.java b/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/exceptions/ConnectionClosedException.java index cefebbf..b881349 100644 --- a/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/exceptions/ConnectionClosedException.java +++ b/rxbluetooth/src/main/java/com/github/ivbaranov/rxbluetooth/exceptions/ConnectionClosedException.java @@ -19,11 +19,7 @@ public final class ConnectionClosedException extends IOException { - public ConnectionClosedException() { - super("Connection is closed."); - } - - public ConnectionClosedException(String message) { - super(message); + public ConnectionClosedException(String message, Throwable cause) { + super(message, cause); } }