Skip to content

Commit a5152cd

Browse files
committed
Updated udev-rules subcommand to catch exceptions.
1 parent ed32bfd commit a5152cd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/busylight/subcommands/udev_rules.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ def generate_udev_rules(
2121
"""
2222
logger.info(f"generating udev rules: {output}")
2323

24-
rules = Light.udev_rules()
25-
about = [
26-
"# Generated by `busylight udev-rules` https://github.com/JnyJny/busylight",
27-
"#",
28-
]
24+
try:
25+
rules = Light.udev_rules()
26+
about = [
27+
"# Generated by `busylight udev-rules` https://github.com/JnyJny/busylight",
28+
"#",
29+
]
30+
except Exception as error:
31+
typer.secho(f"Error generating udev rules: {error}", fg="red")
32+
raise typer.Exit(code=1)
2933

3034
print("\n".join(about + rules), file=output)

0 commit comments

Comments
 (0)