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

fix: catch the stream error #225

Merged
merged 1 commit into from
Feb 10, 2023
Merged

fix: catch the stream error #225

merged 1 commit into from
Feb 10, 2023

Conversation

hung-cybo
Copy link
Contributor

@hung-cybo hung-cybo commented Feb 10, 2023

Why

Currently, we don't catch the stream error, so when the stream throws an error, It's not easy to read

$ ./cli.js record import --app 1 --file-path not_eixst.csv
node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'not_eixst.csv'
Emitted 'error' event on ReadStream instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'not_eixst.csv'
}

What

  • catch the stream error and throw a readable error message, e.g.
Error: ENOENT: no such file or directory, open 'not_eixst.csv'

How to test

yarn build & yarn test

Checklist

  • Read CONTRIBUTING.md
  • Updated documentation if it is required.
  • Added tests if it is required.
  • Passed yarn lint and yarn test on the root directory.

@hung-cybo hung-cybo requested review from a team and tasshi-me and removed request for a team February 10, 2023 02:50
@hung-cybo hung-cybo self-assigned this Feb 10, 2023
@ueokande ueokande changed the title chore: catch the stream error fix: catch the stream error Feb 10, 2023
@ueokande ueokande merged commit cb4d46a into main Feb 10, 2023
@ueokande ueokande deleted the chore/639-catch-enoent-error branch February 10, 2023 06:20
This was referenced Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants