Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

How to handle errors in FormCalc?

Avatar

Not applicable
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

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

Avatar

Not applicable
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