mirror of
https://github.com/knex/knex.git
synced 2025-10-11 16:08:16 +00:00
Merge branch 'master' into gh-pages
* master: 0.1.7 ensure errors are thrown for fn's, fixes #16
This commit is contained in:
commit
d23f5c48e6
@ -27,7 +27,7 @@
|
|||||||
<div class="pilwrap ">
|
<div class="pilwrap ">
|
||||||
<a class="pilcrow" href="#section-1">¶</a>
|
<a class="pilcrow" href="#section-1">¶</a>
|
||||||
</div>
|
</div>
|
||||||
<pre><code>Knex.js 0.1.6
|
<pre><code>Knex.js 0.1.7
|
||||||
|
|
||||||
(c) 2013 Tim Griesser
|
(c) 2013 Tim Griesser
|
||||||
Knex may be freely distributed under the MIT license.
|
Knex may be freely distributed under the MIT license.
|
||||||
@ -91,7 +91,11 @@ http://knexjs.org</code></pre>
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content"><div class='highlight'><pre> Knex.VERSION = <span class="string">'0.1.6'</span>;</pre></div></div>
|
<div class="content"><div class='highlight'><pre> Knex.VERSION = <span class="string">'0.1.7'</span>;
|
||||||
|
|
||||||
|
<span class="keyword">var</span> rethrower = <span class="keyword">function</span>(err) {
|
||||||
|
<span class="keyword">throw</span> err;
|
||||||
|
};</pre></div></div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -129,7 +133,8 @@ used to generate the sql in one form or another.</p>
|
|||||||
</div>
|
</div>
|
||||||
<p>For those who dislike promise interfaces.
|
<p>For those who dislike promise interfaces.
|
||||||
Multiple calls to <code>exec</code> will resolve with the same value
|
Multiple calls to <code>exec</code> will resolve with the same value
|
||||||
if called more than once.</p>
|
if called more than once. Any unhandled errors will be thrown
|
||||||
|
after the last block.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -139,6 +144,8 @@ if called more than once.</p>
|
|||||||
callback(<span class="literal">null</span>, resp);
|
callback(<span class="literal">null</span>, resp);
|
||||||
}, <span class="keyword">function</span>(err) {
|
}, <span class="keyword">function</span>(err) {
|
||||||
callback(err, <span class="literal">null</span>);
|
callback(err, <span class="literal">null</span>);
|
||||||
|
}).then(<span class="literal">null</span>, <span class="keyword">function</span>(err) {
|
||||||
|
setTimeout(<span class="keyword">function</span>() { <span class="keyword">throw</span> err; }, <span class="number">0</span>);
|
||||||
});
|
});
|
||||||
},</pre></div></div>
|
},</pre></div></div>
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@
|
|||||||
<div id="sidebar" class="interface">
|
<div id="sidebar" class="interface">
|
||||||
|
|
||||||
<a class="toc_title" href="#">
|
<a class="toc_title" href="#">
|
||||||
Knex.js <span class="version">(0.1.6)</span>
|
Knex.js <span class="version">(0.1.7)</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="toc_section">
|
<ul class="toc_section">
|
||||||
<li>» <a href="https://github.com/tgriesser/knex">GitHub Repository</a></li>
|
<li>» <a href="https://github.com/tgriesser/knex">GitHub Repository</a></li>
|
||||||
@ -319,7 +319,7 @@
|
|||||||
or send tweets to <a href="http://twitter.com/tgriesser">@tgriesser</a>.
|
or send tweets to <a href="http://twitter.com/tgriesser">@tgriesser</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2>Latest Release: 0.1.6</h2>
|
<h2>Latest Release: 0.1.7</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Current Develop —
|
Current Develop —
|
||||||
@ -1135,6 +1135,11 @@ Knex.Raw('select * from users where id = 1').then(function(resp) {
|
|||||||
|
|
||||||
<h2 id="changelog">Change Log</h2>
|
<h2 id="changelog">Change Log</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b class="header">0.1.7</b> — <small><i>June 12, 2013</i></small><br />
|
||||||
|
Ensures unhandled errors in the <tt>exec</tt> callback interface are re-thrown.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b class="header">0.1.6</b> — <small><i>June 9, 2013</i></small><br />
|
<b class="header">0.1.6</b> — <small><i>June 9, 2013</i></small><br />
|
||||||
Renaming <tt>beforeCreate</tt> to <tt>afterCreate</tt>. Better handling of errors in the connection pooling.
|
Renaming <tt>beforeCreate</tt> to <tt>afterCreate</tt>. Better handling of errors in the connection pooling.
|
||||||
|
13
knex.js
13
knex.js
@ -1,4 +1,4 @@
|
|||||||
// Knex.js 0.1.6
|
// Knex.js 0.1.7
|
||||||
//
|
//
|
||||||
// (c) 2013 Tim Griesser
|
// (c) 2013 Tim Griesser
|
||||||
// Knex may be freely distributed under the MIT license.
|
// Knex may be freely distributed under the MIT license.
|
||||||
@ -23,7 +23,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Keep in sync with package.json
|
// Keep in sync with package.json
|
||||||
Knex.VERSION = '0.1.6';
|
Knex.VERSION = '0.1.7';
|
||||||
|
|
||||||
|
var rethrower = function(err) {
|
||||||
|
throw err;
|
||||||
|
};
|
||||||
|
|
||||||
// Methods common to both the `Grammar` and `SchemaGrammar` interfaces,
|
// Methods common to both the `Grammar` and `SchemaGrammar` interfaces,
|
||||||
// used to generate the sql in one form or another.
|
// used to generate the sql in one form or another.
|
||||||
@ -40,13 +44,16 @@
|
|||||||
|
|
||||||
// For those who dislike promise interfaces.
|
// For those who dislike promise interfaces.
|
||||||
// Multiple calls to `exec` will resolve with the same value
|
// Multiple calls to `exec` will resolve with the same value
|
||||||
// if called more than once.
|
// if called more than once. Any unhandled errors will be thrown
|
||||||
|
// after the last block.
|
||||||
exec: function(callback) {
|
exec: function(callback) {
|
||||||
this._promise || (this._promise = this.runQuery());
|
this._promise || (this._promise = this.runQuery());
|
||||||
return this._promise.then(function(resp) {
|
return this._promise.then(function(resp) {
|
||||||
callback(null, resp);
|
callback(null, resp);
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
callback(err, null);
|
callback(err, null);
|
||||||
|
}).then(null, function(err) {
|
||||||
|
setTimeout(function() { throw err; }, 0);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "knex",
|
"name": "knex",
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.",
|
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.",
|
||||||
"main": "knex.js",
|
"main": "knex.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
var When = require('when');
|
var When = require('when');
|
||||||
|
var assert = require('assert');
|
||||||
|
|
||||||
module.exports = function(Knex, dbName, resolver) {
|
module.exports = function(Knex, dbName, resolver) {
|
||||||
|
|
||||||
describe(dbName, function() {
|
describe(dbName, function() {
|
||||||
@ -7,6 +9,25 @@ module.exports = function(Knex, dbName, resolver) {
|
|||||||
Knex('accounts').select().then(resolver(ok), ok);
|
Knex('accounts').select().then(resolver(ok), ok);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('throws errors on the exec if uncaught in the last block', function(ok) {
|
||||||
|
|
||||||
|
var listeners = process.listeners('uncaughtException');
|
||||||
|
|
||||||
|
process.removeAllListeners('uncaughtException');
|
||||||
|
|
||||||
|
process.on('uncaughtException', function(err) {
|
||||||
|
process.removeAllListeners('uncaughtException');
|
||||||
|
for (var i = 0, l = listeners.length; i < l; i++) {
|
||||||
|
process.on('uncaughtException', listeners[i]);
|
||||||
|
}
|
||||||
|
ok();
|
||||||
|
});
|
||||||
|
|
||||||
|
Knex('accounts').select().exec(function(err, resp) {
|
||||||
|
console.log(undefinedVar);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('uses `orderBy`', function(ok) {
|
it('uses `orderBy`', function(ok) {
|
||||||
Knex('accounts')
|
Knex('accounts')
|
||||||
.select()
|
.select()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user