Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if files exists before trying to open them #81

Closed
mountaindude opened this issue Oct 13, 2022 · 0 comments · Fixed by #84
Closed

Check if files exists before trying to open them #81

mountaindude opened this issue Oct 13, 2022 · 0 comments · Fixed by #84
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@mountaindude
Copy link
Contributor

Applies to both certificate files and Excel files (for importing master items).

Currently a missing file can cause output like below.
Better to just say "missing file ..." and exit.

➜  tools ./ctrl-q master-item-import --host 192.168.100.109 --app-id a3e0f5d2-000a-464f-998d-33d333b175d7 --auth-user-dir LAB --auth-user-id goran --auth-type cert --file-type excel --file ./ctrl-q-testdata.xlsx --sheet Sales --col-ref-by name --col-item-type "Master item type" --col-master-item-name "Master Item Name" --col-master-item-descr "Description" --col-master-item-label "Label" --col-master-item-expr "Expression" --col-master-item-tag "Tag"

2022-10-13T18:26:50.923Z info: Import master items from definitions in Excel file "./ctrl-q-testdata.xlsx"
2022-10-13T18:26:50.927Z error: Error: ENOENT: no such file or directory, open './ctrl-q-testdata.xlsx'
    at Object.openSync (node:fs:585:3)
    at Object.openSync (pkg/prelude/bootstrap.js:796:32)
    at Object.readFileSync (node:fs:453:35)
    at Object.readFileSync (pkg/prelude/bootstrap.js:1082:36)
    at read_binary (/snapshot/ctrl-q/node_modules/xlsx/xlsx.js:2730:44)
    at readSync (/snapshot/ctrl-q/node_modules/xlsx/xlsx.js:21877:69)
    at readFileSync (/snapshot/ctrl-q/node_modules/xlsx/xlsx.js:21909:9)
    at Object.parse (/snapshot/ctrl-q/node_modules/node-xlsx/lib/index.js:10:31)
    at importMasterItemFromExcel (/snapshot/ctrl-q/src/lib/importexcel.js:40:41)
    at importMasterItemFromFile (/snapshot/ctrl-q/src/lib/importexcel.js:324:9)
    at Command.<anonymous> (/snapshot/ctrl-q/src/ctrl-q.js:110:17)
    at Command.listener [as _actionHandler] (/snapshot/ctrl-q/node_modules/commander/lib/command.js:482:17)
    at /snapshot/ctrl-q/node_modules/commander/lib/command.js:1264:65
    at Command._chainOrCall (/snapshot/ctrl-q/node_modules/commander/lib/command.js:1158:12)
    at Command._parseCommand (/snapshot/ctrl-q/node_modules/commander/lib/command.js:1264:27)
    at /snapshot/ctrl-q/node_modules/commander/lib/command.js:1062:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant