add unhandled rejection, demo arg passing

This commit is contained in:
AJ ONeal 2015-07-24 16:10:47 -06:00
parent 172e312f86
commit 89e957af0f
1 changed files with 9 additions and 1 deletions

View File

@ -50,7 +50,7 @@ var opts = {
sqlite.create(opts).then(function (db) {
// same api as new sqlite3.Database(options.filename)
client.run("SELECT 1", [], function (err) {
client.run("SELECT ?", ['Hello World!'], function (err) {
if (err) {
console.error('[ERROR]', cluster.isMaster && '0' || cluster.worker.id);
console.error(err);
@ -61,6 +61,14 @@ sqlite.create(opts).then(function (db) {
console.log(this);
});
});
process.on('unhandledPromiseRejection', function (err) {
console.error('Unhandled Promise Rejection');
console.error(err);
console.error(err.stack);
throw err;
});
```
If you wish to always use clustering, even on a single core system, see `test-cluster.js`.