Error catching for cleaning up
This commit is contained in:
13
sound.py
13
sound.py
@@ -29,16 +29,15 @@ class PCMStream:
|
||||
self.stream.start()
|
||||
|
||||
def clean_up(self):
|
||||
if self.stream is not None:
|
||||
try:
|
||||
try:
|
||||
if self.stream is not None:
|
||||
self.stream.stop()
|
||||
except Exception as e:
|
||||
print(f"Error on Stop: '{e}'")
|
||||
|
||||
try:
|
||||
self.stream.close()
|
||||
except Exception as e:
|
||||
print(f"Error on Close: '{e}'")
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error in clean_up: '{e}'")
|
||||
|
||||
|
||||
|
||||
class DeviceNotFoundError(Exception):
|
||||
|
||||
Reference in New Issue
Block a user