RobotStudio event

Error handling on GetDataVal

<font face="Arial, Verdana"><span style="font-size: 10pt; line-height: normal;">I'm using GetDataVal to look up values which are input by an operator.</span></font><div><font face="Arial, Verdana"><span style="font-size: 13.3333330154419px; line-height: normal;">If the name given by the variable does not exist, the error handler is called with </span></font><span style="font-size: 13.3333330154419px; line-height: normal; font-family: Arial, Verdana;">ERRNO=ERR_SYM_ACCESS which is fine.</span></div><div><span style="font-size: 13.3333330154419px; line-height: normal; font-family: Arial, Verdana;">However, if the name exists but is of a different data type, execution stops without calling the error handler, reporting a "Symbol type error".</span></div><div><span style="font-size: 13.3333330154419px; line-height: normal; font-family: Arial, Verdana;"><br></span></div><div><span style="font-size: 13.3333330154419px; line-height: normal; font-family: Arial, Verdana;">Is there a way to force it to call the error handler, or to find out if the data is of the correct type beforehand?</span></div><div><span style="font-size: 13.3333330154419px; line-height: normal; font-family: Arial, Verdana;"><br></span></div><div><span style="font-size: 13.3333330154419px; line-height: normal; font-family: Arial, Verdana;">Any help would be appreciated</span></div>
Andrew

Comments

  • graafderk
    graafderk
    edited February 2015
    I guess you're out of luck, together with the "symbol type error", the controller throws an "execution error": "The program error is considered UNRECOVERABLE so no error recovery attempt by an error handler routine (if used) was allowed. The actual cause of the error may vary, and is likely to be specified in an event log message logged simultaneously as this one."<div>In my company, we use hungarian notation, meaning that every variable name has a prefix containing the type of the variable. In that case, you could first look at the first one or two characters in the string from the operator and based on that call GetDataVal with a different type of return variable.</div>
  • Thanks, graafderk. Wasn't really what I wanted to hear, but using Hungarian notation is certainly be a good idea for a workaround (I usually use it, but never knew it was called Hungarian Notation!). It needs to be robust, as I want to give my comms task a high trust level, and don't want to bring down the whole system just because someone has mad a typo in their input.
    Andrew