Skip to content

Commit b305040

Browse files
committed
improved device error exception
1 parent ddc3481 commit b305040

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

recorder/config.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from recorder.io import yaml_load
1+
from recorder.io import yaml_dump, yaml_load
22
from recorder.device import Device, DEVICE_CLASSES
33

44
from typing import List
55
from pathlib import Path
66

77
DEFAULT_CONFIG_PATH = Path.cwd() / 'python-recorder.yaml'
88

9-
DEFAULT_OUTPUT_FOLDER = Path.cwd() / 'recordings'
9+
DEFAULT_OUTPUT_FOLDER = Path.cwd() / 'recordings'
1010

1111

1212
class Config(dict):
@@ -46,11 +46,17 @@ def devices(
4646
f'{list(DEVICE_CLASSES.keys())}'
4747
)
4848
for index, device_config in _devices.items():
49-
devices.append(
50-
device_class(
51-
index=index,
52-
output_folder=output_folder,
53-
config=device_config,
49+
try:
50+
devices.append(
51+
device_class(
52+
index=index,
53+
output_folder=output_folder,
54+
config=device_config,
55+
)
5456
)
55-
)
57+
except Exception as e:
58+
raise RuntimeError(
59+
f"Could not initialize {str(device_class)}{index} with "
60+
f"config:\n {yaml_dump(device_config)}\n {str(e)}"
61+
) from e
5662
return devices

0 commit comments

Comments
 (0)