Skip to content

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

Open
@ConradHughes

Description

@ConradHughes

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]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions