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

[FEATURE] Documentation request: example of exception in on('headers') handler #865

Open
1 of 2 tasks
ConradHughes opened this issue Jan 12, 2024 · 0 comments
Open
1 of 2 tasks
Assignees

Comments

@ConradHughes
Copy link

Parsing or Formatting?

  • Formatting
  • Parsing

Is your feature request related to a problem? Please describe.
I've an on('headers') handler which throws an Error in the event of bad headers, but this seems to cause instant process exit rather than resulting in something that the caller can catch.

Describe the solution you'd like
I'd like to see an example of how to induce a failure in an on() handler which causes parsing to terminate and transmits an exception to the caller, rather than exiting the process. I am a little tired so may have missed something, but AFAICS your extensive code samples just seem to console.log problems or exit. Weirdly I'm pretty sure that elsewhere during row parsing I throw errors which do reach the caller, so maybe this is just an issue with on('headers')?

Describe alternatives you've considered
I noticed in your tests that you use Promise.reject to express failures in some handlers. If that's the official recommended route then I think an example of this in the docs would be helpful.

Additional context
[n/a]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants