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

Improve error message for immutable descriptors to include link to article #2533

Open
fatso83 opened this issue Aug 9, 2023 · 3 comments
Open

Comments

@fatso83
Copy link
Contributor

fatso83 commented Aug 9, 2023

Is your feature request related to a problem? Please describe.
See #2528 (comment). Currently it seems people get stuck when seeing the error message "Descriptor for property toBeMocked is non-configurable and non-writable" and think this is some sort of error in Sinon.

Describe the solution you'd like
I was thinking that it might be useful to have error messages point directly to relevant docs that could give the user some context and possible hints at resolving the issue. So instead of "Descriptor for property toBeMocked is non-configurable and non-writable" change it to something like

The descriptor for the property toBeMocked is non-configurable and non-writable. Sinon cannot do anything about this, as it is essentially immutable. Read https://sinonjs.org/faqs#immutable-objectdescriptor for tips on what could cause this and how to possibly resolve it.

(The link is made up by the way). A fix should of course then include a new page in our docs that deals with that specific error. It could contain a short summary of possible reasons the descriptor is immutable (such as transpilation of ESM) and links to articles that show how to solve it.

Copy link

stale bot commented Dec 27, 2023

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Dec 27, 2023
@DanKaplanSES
Copy link
Contributor

I came here to create this issue. I'd also like to see this improvement.

@stale stale bot removed the wontfix label Nov 27, 2024
@fatso83
Copy link
Contributor Author

fatso83 commented Nov 29, 2024

This does not take much, but someone needs to put in some work:

  1. Create some place to hold a FAQ (that was just my suggestion to avoid one page per question) in our docs
  2. Change the error message to point to that URL.

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

2 participants