Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

How to handle errors in FormCalc?

Avatar

Former Community Member
I have an XFA form, that communicates with Web service via FormCalc function

post(Url, Request, "text/xml", "utf-8").

When the Web service returns an exception message or the form could not connect to Web service, it shows a messagebox with "Script failed ..."



Is there something like try/catch in FormCalc to handle these errors so that I could show my custom message instead of showing this not-userfriendly error message?
5 Replies

Avatar

Former Community Member
FormCalc does not have such a thing .....I woudl translate your script over to Javascript where there is a try/catch structure.

Avatar

Former Community Member
Thank you for reply, unfortunately this script only calls the function POST, which must be done via FormCalc. :(

Avatar

Level 1

7 years since the original post ... has Adobe implemented FormCalc try/catch error handling by now?

Avatar

Level 1

I'm wondering about this as well. If I do:

var responseMsg = Post(apiUrl, body, format);

And everything is fine,then I get a json respomse with "success": true etc, but when something is wrong with my post to the API I get a popup error saying something like "Script failed (language is formcalc; context is... and Error: Error attempting to read from file https:// and so on. Really great exception handling there