Skip to content

Commit

Permalink
Make exception handling more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelmsft committed Nov 1, 2022
1 parent b7902d8 commit d945fb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/aaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def add_table_kv(table, entry, key, val):
config_db.connect()
try:
config_db.mod_entry(table, entry, {key:val})
except Exception as e:
except ValueError as e:
ctx = click.get_current_context()
ctx.fail("Invalid ConfigDB. Error: {}".format(e))

Expand All @@ -34,7 +34,7 @@ def del_table_key(table, entry, key):
del data[key]
try:
config_db.set_entry(table, entry, data)
except Exception as e:
except (ValueError, JsonPatchConflict) as e:
ctx = click.get_current_context()
ctx.fail("Invalid ConfigDB. Error: {}".format(e))

Expand Down

0 comments on commit d945fb2

Please sign in to comment.