From 6a9b64d3d6c921bf507e8d7904238ad26ca89013 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 26 May 2014 12:53:55 +1000 Subject: [PATCH] Catch errors in the hval/hget and return the message as the value --- .../instrument/TEST_SICS/unit_tests/test_suite.tcl | 6 +++++- site_ansto/instrument/gumxml.tcl | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/site_ansto/instrument/TEST_SICS/unit_tests/test_suite.tcl b/site_ansto/instrument/TEST_SICS/unit_tests/test_suite.tcl index 1f644fb6..a76e8010 100644 --- a/site_ansto/instrument/TEST_SICS/unit_tests/test_suite.tcl +++ b/site_ansto/instrument/TEST_SICS/unit_tests/test_suite.tcl @@ -81,7 +81,11 @@ proc test_suite::make_nodes {path result indent} { append result "$prefix\n" if {[string compare -nocase $type "none"] != 0} { - set value [test_suite::encode [hval $path]] + if [ catch { + set value [test_suite::encode [hval $path]] + } message ] { + set value "HVAL_ERROR:${message}" + } append result "$prefix $value\n" } foreach p [test_suite::property_elements $path $newIndent] { diff --git a/site_ansto/instrument/gumxml.tcl b/site_ansto/instrument/gumxml.tcl index bddf450a..6595d976 100644 --- a/site_ansto/instrument/gumxml.tcl +++ b/site_ansto/instrument/gumxml.tcl @@ -62,7 +62,11 @@ proc make_nodes {path result indent} { if {"$control" == "true"} { append result "$prefix\n" if {[string compare -nocase $type "none"] != 0} { - set value [encode [hval $path]] + if [ catch { + set value [encode [hval $path]] + } message ] { + set value "HVAL_ERROR:${message}" + } append result "$prefix $value\n" } foreach p [property_elements $path $newIndent] { @@ -126,7 +130,11 @@ proc make_value_nodes {path result indent} { if {"$control" == "true"} { append result "$prefix\n" if {[string compare -nocase $type "none"] != 0} { - set value [encode [hval $path]] + if [ catch { + set value [encode [hval $path]] + } message ] { + set value "HVAL_ERROR:${message}" + } append result "$prefix $value\n" } foreach x [hlist $path] {