Generate code to report errors in script context hook code

This commit is contained in:
Douglas Clowes
2014-02-19 12:06:22 +11:00
parent 2c25c64db3
commit 0ea068cc31

View File

@ -768,6 +768,10 @@ def put_write_function(MyDriver, func):
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' debug_log 1 "[sct] error: [sct geterror]"']
txt += [' return -code error "[sct geterror]"']
txt += [' }']
txt += [' debug_log 1 "%s sct send ${cmd}"' % func] txt += [' debug_log 1 "%s sct send ${cmd}"' % func]
txt += [' sct send "${cmd}"'] txt += [' sct send "${cmd}"']
txt += [' return ${nextState}'] txt += [' return ${nextState}']
@ -800,6 +804,10 @@ def put_fetch_function(MyDriver, func):
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' debug_log 1 "[sct] error: [sct geterror]"']
txt += [' return -code error "[sct geterror]"']
txt += [' }']
txt += [' debug_log 1 "%s sct send ${cmd}"' % func] txt += [' debug_log 1 "%s sct send ${cmd}"' % func]
txt += [' sct send "${cmd}"'] txt += [' sct send "${cmd}"']
txt += [' return ${nextState}'] txt += [' return ${nextState}']
@ -825,10 +833,10 @@ def put_read_function(MyDriver, func):
txt += ['# hook code starts'] txt += ['# hook code starts']
txt += MyDriver['Funcs'][func]['text'] txt += MyDriver['Funcs'][func]['text']
txt += ['# hook code ends'] txt += ['# hook code ends']
txt += [' if { [hpropexists [sct] geterror] } {'] txt += [' if { [hpropexists [sct] geterror] } {']
txt += [' debug_log 1 "[sct] error: [sct geterror]"'] txt += [' debug_log 1 "[sct] error: [sct geterror]"']
txt += [' return -code error "[sct geterror]"'] txt += [' return -code error "[sct geterror]"']
txt += [' }'] txt += [' }']
txt += [' if { ${data} != [sct oldval] } {'] txt += [' if { ${data} != [sct oldval] } {']
txt += [' debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"'] txt += [' debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"']
txt += [' sct oldval ${data}'] txt += [' sct oldval ${data}']