From 63add7d6087f384c072e3d0c57126d41b00c98a8 Mon Sep 17 00:00:00 2001 From: Niklas Baudy Date: Fri, 26 Oct 2018 21:24:05 +0200 Subject: [PATCH] Add cause to ConnectionClosedException. --- .../github/ivbaranov/rxbluetooth/BluetoothConnection.java | 2 +- .../rxbluetooth/exceptions/ConnectionClosedException.java | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) 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 9524d5e..294749f 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 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); } }