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

exec() with no callback throws TypeError: undefined is not a function #49

Closed
tjwebb opened this Issue Aug 26, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@tjwebb
Collaborator

tjwebb commented Aug 26, 2013

Consider the following simple queries:

Knex('table').where('id', 1).update({ value: "hello" }).exec();
Knex('table').where('id', 1).update({ value: "hello" }).then();

Query 1 succeeds, but then throws:

TypeError: undefined is not a function

Query 2 succeeds with no error.

tgriesser added a commit that referenced this issue Aug 26, 2013

@tgriesser

This comment has been minimized.

Owner

tgriesser commented Aug 26, 2013

I'm not sure that you'd want to call either of those without a handler, but fair enough, should be fixed.

@tgriesser tgriesser closed this Aug 26, 2013

@tjwebb

This comment has been minimized.

Collaborator

tjwebb commented Aug 26, 2013

My main point is that behavior should be consistent. Either then() and exec() should both fail, or both should succeed.

@tgriesser

This comment has been minimized.

Owner

tgriesser commented Aug 26, 2013

Yeah, that's a good point - consistency is important, and since the promise A+ spec defines the onFulfilled and onRejected handlers as both being optional, it'd make sense that the exec() handler be optional as well. Thanks for pointing that out.

tgriesser added a commit that referenced this issue Sep 4, 2013

Merge branch 'master' into migrate
* master:
  release 0.2.6
  prep for 0.2.6
  reject transaction promise if commit fails (fixes #50)
  release 0.2.5
  fix for #49, prep for 0.2.5

elliotf pushed a commit to elliotf/knex that referenced this issue Nov 24, 2014

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