Skip to content

Commit 657d2a3

Browse files
remote/client: turn wrong match ValueError into UserError
When providing a wrong match pattern, a ValueError is raised, resulting in exception and traceback being printed. To improve the user experience, turn it into a UserError. UserErrors are displayed more end-user friendly, but still allow traceback printing when called via `labgrid-client -d`. Signed-off-by: Bastian Krause <bst@pengutronix.de>
1 parent 32480e9 commit 657d2a3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

labgrid/remote/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,10 @@ def _get_places_by_resource(self, resource_path):
302302

303303
async def print_resources(self):
304304
"""Print out the resources"""
305-
match = ResourceMatch.fromstr(self.args.match) if self.args.match else None
305+
try:
306+
match = ResourceMatch.fromstr(self.args.match) if self.args.match else None
307+
except ValueError as e:
308+
raise UserError(str(e)) from e
306309

307310
# filter self.resources according to the arguments
308311
nested = lambda: defaultdict(nested)

0 commit comments

Comments
 (0)