mirror of
https://github.com/aljazceru/signal-cli.git
synced 2026-01-22 07:04:26 +01:00
Add DeviceNotFound Error
This commit is contained in:
@@ -111,7 +111,11 @@ public class DbusSignalImpl implements Signal {
|
||||
@Override
|
||||
public DBusPath getDevice(long deviceId) {
|
||||
updateDevices();
|
||||
return new DBusPath(getDeviceObjectPath(objectPath, deviceId));
|
||||
final var deviceOptional = devices.stream().filter(g -> g.getId().equals(deviceId)).findFirst();
|
||||
if (deviceOptional.isEmpty()) {
|
||||
throw new Error.DeviceNotFound("Device not found");
|
||||
}
|
||||
return deviceOptional.get().getObjectPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user