Skip to content

Commit b574d21

Browse files
authored
Merge pull request #3907 from hansu/halshow-error-handling-2.9
halshow: handle error when item from watchlist is removed during runtime
2 parents 8ef8e16 + af3a1c2 commit b574d21

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

tcl/bin/halshow.tcl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ proc watchHAL {which} {
858858
# ptype (and getp) fail when the item clicked is not a leaf
859859
# e.g., clicking "Pins / axis / 0"
860860
if {[catch {hal ptype $varname} type]} {
861-
setStatusbar $type
861+
setStatusbar "Watch: $type"
862862
return $type
863863
}
864864
}
@@ -1113,12 +1113,22 @@ proc setWatchInterval {} {
11131113

11141114
proc refreshItem {cnum vartype varname} {
11151115
if {$vartype == "sig" } {
1116-
set ret [hal gets $varname]
1117-
set varnumtype [hal stype $varname]
1116+
set getCmd gets
1117+
set typeCmd stype
11181118
} else {
1119-
set ret [hal getp $varname]
1120-
set varnumtype [hal ptype $varname]
1119+
set getCmd getp
1120+
set typeCmd ptype
1121+
}
1122+
1123+
if {[catch { set ret [hal $getCmd $varname] } error]} {
1124+
setStatusbar $error
1125+
$::cisp itemconfigure text$cnum -text "----"
1126+
$::cisp itemconfigure oval$cnum -fill lightgray
1127+
return
11211128
}
1129+
1130+
set varnumtype [hal $typeCmd $varname]
1131+
11221132
if {$ret == "TRUE"} {
11231133
$::cisp itemconfigure oval$cnum -fill yellow
11241134
} elseif {$ret == "FALSE"} {

0 commit comments

Comments
 (0)