[javascript FR] app.openDoc error on file not found is confusing

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
Mathew
User
Posts: 923
Joined: Thu Jun 19, 2014 7:30 pm

[javascript FR] app.openDoc error on file not found is confusing

Post by Mathew »

When app.openDoc() tries to open a file that does not exist, the error returned is confusing: "NotAllowedError: Security settings prevent access to this property or method."

Could we get an error that's more like "File not found" -- would help with debugging scripts.

Thanks!

To reproduce, the following adds an arbitrary string to the end of the selected file name and tries to open it:

Code: Select all

{
let d = app.browseForDoc();
if (d) {
  try {
    app.openDoc(d.cPath + "asdf");
  } catch (e) {
    console.println(JSON.stringify(e,null,1));
  }
}
}
User avatar
Sean - PDF-XChange
Site Admin
Posts: 1233
Joined: Wed Sep 14, 2016 5:42 pm

Re: [javascript FR] app.openDoc error on file not found is confusing

Post by Sean - PDF-XChange »

Hi Mathew,

I have let the team know and will get back to you with their response.

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623
User avatar
Sean - PDF-XChange
Site Admin
Posts: 1233
Joined: Wed Sep 14, 2016 5:42 pm

Re: [javascript FR] app.openDoc error on file not found is confusing

Post by Sean - PDF-XChange »

Update: a ticket has been made in relation to this issue:

#7913: Issue with Incorrect Error Message on app.openDoc

Kind regards,
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623