Skip to content

doc, types, test: Use Error objects instead of plain objects with replyWithError() - #2900

Merged
mikicho merged 5 commits into
nock:mainfrom
okko:fix/tests-types-replyWithError-Error-objects
Aug 12, 2025
Merged

mikicho merged 5 commits into
nock:mainfrom
okko:fix/tests-types-replyWithError-Error-objects

Conversation

@okko

@okko okko commented Aug 6, 2025 •

Copy link
Copy Markdown
Contributor

Includes #2899
Fixes #2789

@mikicho

mikicho commented Aug 6, 2025

Copy link
Copy Markdown
Member

Thank you @okko!
The thing is that I'm still wondering if we should support plain object errors. IIRC, this is valid from the node perspective, also not sure how useful it really is.

@okko

okko commented Aug 7, 2025 •

Copy link
Copy Markdown
Contributor Author

Same here, I don't know what the use case for that would be, but can't rule it out. I would merge at least #2899 to document usage that better reflects what Node apparently does internally.

Then maybe wait with this #2900. On the other hand, reverting this is super easy if someone presents a use case.

@mikicho mikicho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, the fix is pretty easy form suer perspective as well, so let's merge this and see if we get any pushback

@mikicho

mikicho commented Aug 11, 2025

Copy link
Copy Markdown
Member

@okko can you please:

  1. Fix the format
  2. Remove the support for
  3. Remove the skipped test (or add one with an error object if it does not already exist, please)

@okko okko changed the title types, test: Use Error objects instead of plain objects with replyWithError() doc, types, test: Use Error objects instead of plain objects with replyWithError() Aug 12, 2025
@okko

okko commented Aug 12, 2025

Copy link
Copy Markdown
Contributor Author

@mikicho Thanks! I fixed formatting and enabled the test. I didn't get the 2nd point of your comment, was there a word missing?

@mikicho
mikicho enabled auto-merge (squash) August 12, 2025 15:39
@mikicho
mikicho merged commit f2a3389 into nock:main Aug 12, 2025
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 15.0.0-beta.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

replyWithError with object does not work since beta-8+

2 participants