🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

HM Error Message Handling

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

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...

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "tinh"
    Altair Community Member
    Updated by tinh

    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

    }

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hi tinh

    Thanks for your response.

    I'll try and let you know.

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    I think it works fine.

    Thanks for your response.