I have a following procedure:
proc show_information {args} {
set mandatory_args {
-tftp_server
-device ANY
-interface ANY
}
set optional_args {
-vlan ANY
}
parse_dashed_args -args $args -optional_args $optional_args -mandatory_args $mandatory_args
log -info "Logged in device is: $device"
log -info "Executing proc to get all data"
set commands {
"show mpls ldp neighbor"
"show mpls discovery vpn"
"show mpls interface"
"show mpls ip binding"
"show running-config"
"show policy-map interface $intr vlan $vlan input"
"show run interface $intr
}
foreach command $commands {
set show [$device exec $command]
ats_log -info $show
}
}
I am new to tcl and wants to know how can we handle error if anyhow we pass wrong parameter or it errors out. Something like python try *(executes the proc) and except *(prints some msg in case of failure) in TCL.
After some googling 'catch' is what is used in TCL but not able to figure out how can I use it.