Browse Source

CC1101.transmit: raise `RuntimeError` instead of `Exception` when attempting to transmit in non-idle state (fixing pylint's broad-exception-raised warning)

Fabian Peter Hammerle 1 year ago
parent
commit
49ea3820ff
2 changed files with 5 additions and 1 deletions
  1. 4 0
      CHANGELOG.md
  2. 1 1
      cc1101/__init__.py

+ 4 - 0
CHANGELOG.md

@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Added
 - declare compatibility with `python3.11`
 
+### Changed
+- `CC1101.transmit`: raise `RuntimeError` instead of `Exception` when
+  attempting to transmit in non-idle state
+
 ### Removed
 - compatibility with `python3.5` & `python3.6`
 

+ 1 - 1
cc1101/__init__.py

@@ -901,7 +901,7 @@ class CC1101:
             )
         marcstate = self.get_main_radio_control_state_machine_state()
         if marcstate != MainRadioControlStateMachineState.IDLE:
-            raise Exception(
+            raise RuntimeError(
                 f"device must be idle before transmission (current marcstate: {marcstate.name})"
             )
         self._flush_tx_fifo_buffer()