Skip to main content
janh24215362
Participant
November 24, 2020
Question

Error cannot be catched on this.submitForm if user is offline in Acrobat Reader.

  • November 24, 2020
  • 1 reply
  • 539 views

I have this javascript code in PDF file:

try {
   this.submitForm({
      cURL: url,
      cCharset: "utf-8"
   });
} 
catch (e) {
   app.alert("error");
}

The "try catch" does not work if user is not connected to the network and this error appears in Adobe Acrobat Reader:

There are two possible solution in my head, but I don't know how to do it. I have read the documentation and could not resolve this:

Can I somehow disable(catch) this error message?

OR

Can I somehow check if the server is responding before submitting the form?

My desired behavior is to do nothing if the user is not connected to the network and send the form if user is connected.
I hope that someone helps me. Thanks.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
November 24, 2020

1) What you tried with the try-catch clause is the only way to catch an error, but some errors can't be caught in this way.

2) Not sure that's possible, but you can maybe try the launchURL method of the app object and see if that throws a catchable error when there's no internet connection...

janh24215362
Participant
November 24, 2020

Thanks for reply. However this opens a link in a browser and does not throws an error. I need something that user does not see. I need something that fetches some data from our server and check if they are valid, I tried a lot of methods from documentation and it does not work or it throws some security error.