-
Notifications
You must be signed in to change notification settings - Fork 1
Readability: Bare except clauses hide errors #36
Copy link
Copy link
Open
Description
Summary
Several places in the code use bare except clauses (except: or except Exception:) which catch all exceptions and make debugging difficult.
Locations
linux.py - Multiple bare except blocks
# line 350-351
except:
pass
# line 471-472
except:
pass
# line 841-842
except:
passpipewire_native.py
# line 1064
except:
pass
# line 1375-1376
except:
passlinux.py LinuxBackend.del
# line 1386-1391
def __del__(self) -> None:
"""Destructor to ensure cleanup."""
try:
self.close()
except:
passImpact
- Exceptions are silently swallowed
- Makes debugging difficult
- May hide actual bugs
- Violates PEP 8 ("Bare except is equivalent to except BaseException")
Suggested Fix
- At minimum, log the exception:
except Exception as e:
logger.debug(f"Cleanup failed (non-critical): {e}")- Or catch specific exception types:
except (OSError, RuntimeError):
pass # Expected during cleanup- For del methods, at least catch and ignore Exception (not BaseException):
except Exception:
pass # Suppress cleanup errors in destructorLabels
readability, enhancement
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels