Skip to content

Instantly share code, notes, and snippets.

@mackwic
Last active August 29, 2015 14:04
Show Gist options
  • Save mackwic/53113fb50ff4b90a33ee to your computer and use it in GitHub Desktop.
Save mackwic/53113fb50ff4b90a33ee to your computer and use it in GitHub Desktop.
# Activate the Bluebird (promises) debug mode
global.process.env.BLUEBIRD_DEBUG = 1 unless window.ENV is 'production'
# Expose the WebSQL methods to nodejs
global.openDatabase = window.openDatabase
global.Knex = knex = require('knex')({
client: 'websql'
version: '2.0'
name: "feetme-#{window.ENV}"
estimated: 1 * (1024 ** 2) # 1 Mio
debug: true
})
global.Bookshelf = require('bookshelf')(knex)
# Any of these queries fail with the same stack trace
knex.raw('select 1;').exec()
knex.raw("date('now');").exec()
knex.schema.createTable('test', (table) ->
table.increment()
table.timestamps()
).exec()
/*
* With BLUEBIRD_DEBUG = 1
*/
[37494:0716/124815:INFO:CONSOLE(97)] ""Possibly unhandled Error: TypeError: Illegal invocation
From previous event:
at Object.finallyHandler (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/finally.js:63:31)
From previous event:
at Function.Promise$Bind (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/promise.js:302:9)
at Runner_WebSQL.eval (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/lib/runner.js:27:18)
at Raw_SQLite3.Target.then (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/lib/interface.js:25:27)
at eval (file:///Users/thomas/Documents/projects/js/feetme/app/common/boot.js:38:47)
at Object.invoke (file:///Users/thomas/Documents/projects/js/feetme/app/bower_components/angular/angular.js:3805:17)
at eval (file:///Users/thomas/Documents/projects/js/feetme/app/bower_components/angular/angular.js:3651:71)
at Array.forEach (native)"", source: /Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/captured_trace.js (97)
/*
* With BLUEBIRD_DEBUG = 0
*/
Possibly unhandled Error: TypeError: Illegal invocation
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/promise.js:720:58)
at Promise$_settlePromiseAt [as _settlePromiseAt] (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/promise.js:868:14)
at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/async.js:74:12)
at Async$consumeFunctionBuffer (/Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/async.js:37:14)
at process._tickCallback (node.js:534:11)"", source: /Users/thomas/Documents/projects/js/feetme/app/node_modules/knex/node_modules/bluebird/js/main/captured_trace.js (97)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment