HM Error Message Handling
I have made the HM as server and I have written a small application as client,
Client will send request to the HM like loading file,hiding the assembly etc via sockets and it is working fine.
I have written a function to query the xyz of the node. It is working fine as long as the node is in the model.
My script has this:
if{ catch[ { set nodeXYZ [hm_getentityvalue nodes $nodeID 'x' 0] } errCode] } {
tk_messageBox -message 'Node not found'
}
where $nodeID contains the id of the node.
If it is not there in the model I want to show my own error message but now HM shows the Application Error message which I dont want to show.
How can I make not to show the Application Error messages in HM?
I tired hm_blockerrormessage 1 and hm_blockmessages 1, but no use.
If I use in HM command window , I'm getting the expected result [ i.,e it shows the error message 'Node not found' ]
But It does not work when I launch HM as server...
Hi
I think hm will not throw an error to server, just a message
anyway i think your code should be:
if {[hm_entityinfo exist nodes $nodeID]} {
lassign [expr [hm_nodevalue $nodeID]] x y z
#return value to client return [list $x $y $z]
} else {
tk_messageBox -title 'Error node not found' -message 'Node $nodeID not found in current model' -icon error
#return a message to client return '...'
}
no need 'hm_blockerrormessages' because above code will not raise any error
ps: your 'catch' command look strange
usually i will write :
if {[ catch {set nodeXYZ ... } ]} {
#show error
}