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

Make GM_setValue throw a descriptive error, when called with insufficient arguments #1005

Closed
arantius opened this issue Aug 11, 2009 · 5 comments
Milestone

Comments

@arantius
Copy link
Collaborator

Originally: DevjaVu ticket 44

If GM_setValue receives a single argument in produces an error message because the second argument is undefined. This is confusing if the name argument has been omitted, e.g.:

GM_setValue(GM_getValue("count", 0) + num);

The thrown error sends the debugger in the wrong direction, searching for places that undefined could creep into num.

Proposal: GM_setValue should test that arguments.length === 2 and throw an error if the assertion fails.

@erikvold
Copy link
Contributor

erikvold commented Sep 5, 2009

if (arguments.length !== 2) {
  throw new Error("GM_setValue requires 2 arguments");
}

Look alright?

@avindra
Copy link

avindra commented Sep 14, 2009

I think this is unnecessary.

@arantius
Copy link
Collaborator Author

Patch available, no obvious backwards compatibility issues. Tagged for v.next

@Martii
Copy link
Contributor

Martii commented Nov 1, 2009

Integrated via this commit.

Anthony you may want to actually notate this and always ensure that a label is always present on each closed issue yourself when merging upstream.

@arantius
Copy link
Collaborator Author

arantius commented Nov 2, 2009

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

No branches or pull requests

4 participants