Refactor Bluetooth error handling

This commit is contained in:
zakorgy 2016-07-21 12:41:47 +02:00 committed by zakorgyula
parent d8991496c6
commit b4db14471b
7 changed files with 76 additions and 62 deletions

View file

@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::
BluetoothRemoteGATTCharacteristicMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
use dom::bindings::error::Error::{InvalidModification, Network, NotSupported, Security, Type};
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
use dom::bindings::error::{Fallible, ErrorResult};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, MutHeap, Root};
@ -115,7 +115,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
descriptor.instance_id))
},
Err(error) => {
Err(Type(error))
Err(Error::from(error))
},
}
}
@ -147,7 +147,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
.collect())
},
Err(error) => {
Err(Type(error))
Err(Error::from(error))
},
}
}
@ -177,7 +177,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
ByteString::new(val)
},
Err(error) => {
return Err(Type(error))
return Err(Error::from(error))
},
};
*self.value.borrow_mut() = Some(value.clone());
@ -202,7 +202,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
match result {
Ok(_) => Ok(()),
Err(error) => {
Err(Type(error))
Err(Error::from(error))
},
}
}