From 4e2f66f7098503ba1016256b11d9dd32f11bcf33 Mon Sep 17 00:00:00 2001 From: Abel Lucas Date: Thu, 20 Oct 2022 22:11:07 +0000 Subject: [PATCH] device: raise a `CommandTimeoutError` error on command timeout --- bumble/core.py | 4 ++++ bumble/device.py | 1 + 2 files changed, 5 insertions(+) diff --git a/bumble/core.py b/bumble/core.py index f024c12d..b10db0b4 100644 --- a/bumble/core.py +++ b/bumble/core.py @@ -91,6 +91,10 @@ class TimeoutError(Exception): """ Timeout Error """ +class CommandTimeoutError(Exception): + """ Command Timeout Error """ + + class InvalidStateError(Exception): """ Invalid State Error """ diff --git a/bumble/device.py b/bumble/device.py index ae150889..44c9a864 100644 --- a/bumble/device.py +++ b/bumble/device.py @@ -784,6 +784,7 @@ class Device(CompositeEventEmitter): ) except asyncio.TimeoutError: logger.warning('!!! Command timed out') + raise CommandTimeoutError() async def power_on(self): # Reset the controller