EasyManua.ls Logo

Newport XPS-Q8 - Getting Started

Newport XPS-Q8
66 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XPS-Q8 Tcl Manual
6.0 Proposed Function for Error Handling
For convenient error debugging and safe program execution, the response (errors) of
each XPS command should be read and tested. To do this, a procedure to “display error
and close” can be used. This procedure is defined at the beginning of Tcl scripts. Users
simply have to call this procedure after each API. This allows for a significant reduction
of code when many APIs are used.
###########################################
# Display error and close procedure #
###########################################
proc DisplayErrorAndClose {socketID code APIName telnetOut} {
# Set global variable
global tcl_argv
# If error occurred other than Timeout error
if {$code != -2} {
# Error => Get error description
set code2 [catch "ErrorStringGet $socketID $code strError"]
# If error occurred with the API ErrorStringGet
if {$code2 != 0} {
# Display API name, error code and
# ErrorStringGet error code
# in the telnet window when using APIs
# TCLScriptExecute or
# TCLScriptExecuteAndWait
puts $telnetOut "$APIName ERROR => $code /
ErrorStringGet ERROR => $code2"
# Force transfer to channel’s output buffer
flush $telnetOut
# in the web terminal when using API
# TCLScriptExecuteAndWait
set tcl_argv(0) "$APIName ERROR => $code"
} else {
# Display API name, number and description
# of the error
# in the telnet window when using APIs
#TCLScriptExecute or
# TCLScriptExecuteAndWait
puts $telnetOut "$APIName ERROR => $code :
$strError
# Force transfer to channel’s output
# buffer
flush $telnetOut
# in the web terminal when using API
# TCLScriptExecuteAndWait
set tcl_argv(0) "$APIName ERROR => $code : $strError"
}
} else {
# Display Timeout error
EDH0307En1041 — 10/17
20

Table of Contents

Other manuals for Newport XPS-Q8

Related product manuals