Expand my Community achievements bar.

Preventing Form Calc Runtime Error Message Dialog

Avatar

Former Community Member
When there is an runtime error in a script written in JavaScript, Adobe Reader "swallows" the error (if it is not caught). I mean, it may write the error to the console, but the user isn't warned of the fact, through a message box.



So, for the user, everything is well.



For the programmer, because he can use a top level try/catch/finally statement, if he is interested in knowing of the fact, this behaviour is a good compromise.



If there is a syntax error in a script written in JavaScript Adobe Reader also does not alert the user of the fact.



If you write code in FormCalc the behaviour is the exact opposite.



Syntax errors show up to the user. This may be admissible because, with thorough testing, it will happen in development-time.



But runtime errors always show up to the user. A big dialog, as tall as your code, shows the code to the user, and, at the bottom, possibly already off the screen, the description of runtime error. This may be an ugly description, depending on what failed.



As far as I know, there is no construct in the Form Calc language that allows catching errors, so you're stuck.



To make things worse not every FormCalc function is available in JavaScript. Many useful functions only exist in FormCalc.



I tried calling FormCalc scripts from JavaScript scripts, using the field.execEvent('...') and it works, appart from a lot of dificulties in passing parameters to, and returning results from, using fields' values as intermediaries of this interaction.



Yet, a try/catch/finally block in the calling JavaScript script does not catch FormCalc errors...so we're back again to the same problem.



All this, imho, is an absurd, and can only be understood as some market-like feature.



Is there ANY undocumented way or dirty trick to prevent FormCalc error messages from displaying to the user?

Or

Is there ANY undocumented way or dirty trick to catch FormCalc error messages, in FormCalc code?
1 Reply

Avatar

Former Community Member
Duarte:



You cannot catch exceptions in FormCalc -- it doesn't have that language feature. If this is important to you, you need to stay with JavaScript. Of course there are certain functions that are available only in FormCalc. There is a way to get at those functions from JavaScript. See my blog post at:

http://blogs.adobe.com/formfeed/2009/02/calling_formcalc_functions_fro.html



John