Skip to content

Commit

Permalink
Avoid throwing exception in case incorrect TV name was passed
Browse files Browse the repository at this point in the history
This instead outputs a nicer error message to the user.
  • Loading branch information
Tenzer committed Dec 11, 2023
1 parent 5fae23d commit 0ff499b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions LGTV/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ def main():
print("A TV name is required. Set one with -n/--name or the setDefault command.")
sys.exit(1)

if name not in config:
print(f"No entry with the name '{name}' was found in the configuration at {filename}.")
sys.exit(1)

if args.command == "sendButton":
cursor = LGTVCursor(name, **config[name], ssl=args.ssl)
cursor.connect()
Expand Down

0 comments on commit 0ff499b

Please sign in to comment.