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

Inconsistent invocation of callbacks for bad values #123

Closed
PsychoLlama opened this issue Nov 13, 2015 · 1 comment
Closed

Inconsistent invocation of callbacks for bad values #123

PsychoLlama opened this issue Nov 13, 2015 · 1 comment
Labels

Comments

@PsychoLlama
Copy link
Contributor

When passing in bad values to .set or .put, sometimes the callbacks are invoked, and sometimes they aren't. For example:

Gun().get('test').set(NaN, function () {
  console.log(arguments)
})
// the function is never called

But if you pass in Infinity instead, the callback will fire, passing in an error object with the message "Invalid value at [soul]!". But it doesn't stop there! There's even inconsistency between .set and .put (even though .set uses .put under the hood).

Gun().get('test').path('callback madness').set(Infinity, callback)
// invoked, error given. Let's try put this time...
Gun().get('test').path('callback madness').put(Infinity, callback)
// not invoked, no error! What?

These errors might be the last string of sanity that beginners have, since gun doesn't throw traditional errors.

@metasean
Copy link
Collaborator

metasean commented Jan 4, 2016

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

No branches or pull requests

3 participants