mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Error handling
This commit is contained in:
parent
b851045415
commit
27ad1437a1
8 changed files with 61 additions and 76 deletions
|
@ -188,10 +188,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
},
|
||||
BluetoothObjectMsg::Error {
|
||||
error
|
||||
} => {
|
||||
println!("{}", error);
|
||||
None
|
||||
},
|
||||
} => return Err(Type(error)),
|
||||
_ => unreachable!()
|
||||
};
|
||||
*self.value.borrow_mut() = value;
|
||||
|
@ -200,19 +197,17 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue
|
||||
fn WriteValue(&self, value: Vec<u8>) {
|
||||
fn WriteValue(&self, value: Vec<u8>) -> Fallible<()> {
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
self.get_bluetooth_thread().send(
|
||||
BluetoothMethodMsg::WriteValue(self.get_instance_id(), value, sender)).unwrap();
|
||||
let result = receiver.recv().unwrap();
|
||||
match result {
|
||||
BluetoothObjectMsg::BluetoothWriteValue => (),
|
||||
BluetoothObjectMsg::BluetoothWriteValue => Ok(()),
|
||||
BluetoothObjectMsg::Error {
|
||||
error
|
||||
} => {
|
||||
println!("{}", error);
|
||||
},
|
||||
} => Err(Type(error)),
|
||||
_ => unreachable!()
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue