Catch specific exceptions and handle them accordingly
Signed-off-by: y-bharath14 <y.bharath@samsung.com>
cmdstr = f"show ip route {ipaddr_str} json"
try:
output = json.loads(router.vtysh_cmd(cmdstr))
- except:
+ except (json.JSONDecodeError, ValueError):
output = {}
ret = topotest.json_cmp(output, expected)
cmdstr = f"ip -json route show {ipaddr_str}"
try:
output = json.loads(router.cmd(cmdstr))
- except:
+ except (json.JSONDecodeError, ValueError):
output = []
return topotest.json_cmp(output, expected)