diff options
author | fokinv <fokin.valentin@stud.u-szeged.hu> | 2016-10-06 13:01:53 +0200 |
---|---|---|
committer | zakorgyula <gyula.zakor@gmail.com> | 2016-11-04 15:36:44 +0100 |
commit | 98f2233f2d232775150bdf0d5348efa167b10018 (patch) | |
tree | d0bacdc10ba42b41544103b6dc2d0c13f7f92ab3 | |
parent | 4ed461c6e5e3349ec92c29c5a449b08b54503d90 (diff) | |
download | servo-98f2233f2d232775150bdf0d5348efa167b10018.tar.gz servo-98f2233f2d232775150bdf0d5348efa167b10018.zip |
Return with NotFoundError insted of TypeError, when adapter is not found.
3 files changed, 4 insertions, 16 deletions
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 5519d74f408..69b22b60e11 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -31,10 +31,6 @@ use std::thread; use std::time::Duration; use util::thread::spawn_named; -const ADAPTER_ERROR: &'static str = "No adapter found"; - -const ADAPTER_NOT_POWERED_ERROR: &'static str = "Bluetooth adapter not powered"; - // A transaction not completed within 30 seconds shall time out. Such a transaction shall be considered to have failed. // https://www.bluetooth.org/DocMan/handlers/DownloadDoc.ashx?doc_id=286439 (Vol. 3, page 480) const MAXIMUM_TRANSACTION_TIME: u8 = 30; @@ -75,11 +71,11 @@ macro_rules! get_adapter_or_return_error( match $bl_manager.get_or_create_adapter() { Some(adapter) => { if !adapter.is_powered().unwrap_or(false) { - return drop($sender.send(Err(BluetoothError::Type(ADAPTER_NOT_POWERED_ERROR.to_string())))) + return drop($sender.send(Err(BluetoothError::NotFound))) } adapter }, - None => return drop($sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))), + None => return drop($sender.send(Err(BluetoothError::NotFound))), } ); ); @@ -701,7 +697,7 @@ impl BluetoothManager { } let mut adapter = match self.get_or_create_adapter() { Some(a) => a, - None => return drop(sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))), + None => return drop(sender.send(Err(BluetoothError::NotFound))), }; let device = match self.device_from_service_id(&service_id) { Some(device) => device, @@ -735,7 +731,7 @@ impl BluetoothManager { } let mut adapter = match self.get_or_create_adapter() { Some(a) => a, - None => return drop(sender.send(Err(BluetoothError::Type(ADAPTER_ERROR.to_string())))), + None => return drop(sender.send(Err(BluetoothError::NotFound))), }; let device = match self.device_from_service_id(&service_id) { Some(device) => device, diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-not-present.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-not-present.html.ini deleted file mode 100644 index e3387360d4a..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-not-present.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[adapter-not-present.html] - type: testharness - [Reject with NotFoundError if the adapter is not present.] - expected: FAIL diff --git a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-off.html.ini b/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-off.html.ini deleted file mode 100644 index b1efda59017..00000000000 --- a/tests/wpt/mozilla/meta/mozilla/bluetooth/requestDevice/adapter-off.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[adapter-off.html] - type: testharness - [Reject with NotFoundError if the adapter is off.] - expected: FAIL |