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

feat!: drop throwOnError #3451

Merged
merged 2 commits into from
Aug 14, 2024
Merged

feat!: drop throwOnError #3451

merged 2 commits into from
Aug 14, 2024

Conversation

metcoder95
Copy link
Member

This relates to...

Rationale

Changes

Features

Bug Fixes

Breaking Changes and Deprecations

Status

@metcoder95 metcoder95 requested a review from ronag August 12, 2024 21:17

class RequestHandler extends AsyncResource {
constructor (opts, callback) {
if (!opts || typeof opts !== 'object') {
throw new InvalidArgumentError('invalid opts')
}

const { signal, method, opaque, body, onInfo, responseHeaders, throwOnError, highWaterMark } = opts
const { signal, method, opaque, body, onInfo, responseHeaders, highWaterMark } = opts

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw error if throwError === true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we? Its a major, it means overall that it won't work if not documented.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't hurt? Less suprising to people that don't update their code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair: f723cc2

@ronag ronag requested a review from mcollina August 12, 2024 21:28
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit e68bd24 into main Aug 14, 2024
38 checks passed
@mcollina mcollina added the semver-major Features or fixes that will be included in the next semver major release label Aug 14, 2024
@metcoder95 metcoder95 deleted the feat/drop_throwOnError branch August 15, 2024 06:40
@github-actions github-actions bot mentioned this pull request Dec 3, 2024
@kibertoad
Copy link
Contributor

@metcoder95 Why was this removed without a linked issue or discussion or rationale given?..

@metcoder95
Copy link
Member Author

For further reference, as i believe we missed more context while working on this:

We dropped it but not fully dropped it
We removed the feature it as an option from the dispatcher as we believe it doesn't belong to core-per se as it alters heavily the behaviour of the dispatcher which is not designed to throw on on-successful responses.

Instead, we provided the built-in responseError interceptor that does exactly the same but as interceptor; in that way we can preserve that feature for who are interested in it, but drop it within the dispatcher itself: https://undici.nodejs.org/#/docs/api/Dispatcher?id=responseerror

This was referenced Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-major Features or fixes that will be included in the next semver major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants