@live-change/dao 0.5.8 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Observable.js CHANGED
@@ -29,7 +29,10 @@ class Observable {
29
29
  if(signal == 'error') {
30
30
  let error = args[0]
31
31
  handled = this.handleError(error) || handled
32
- if(!handled) debug("Unhandled observable error: "+ (error.message || error))
32
+ if(!handled) {
33
+ debug("Unhandled observable error: "+ (error.message || error.stack || error))
34
+ debug("Error: ", error)
35
+ }
33
36
  }
34
37
  }
35
38
 
@@ -448,7 +448,7 @@ class Connection extends EventEmitter {
448
448
  }
449
449
 
450
450
  dispose() {
451
- console.log("DISPOSE REACTIVE CONNECTION")
451
+ debug("DISPOSE REACTIVE CONNECTION")
452
452
  this.finished = true
453
453
  for(const timeout of this.activeTimeouts) clearTimeout(timeout)
454
454
  }
@@ -419,7 +419,8 @@ class ReactiveServerConnection extends EventEmitter {
419
419
 
420
420
  if(this.settings.fastAuth) {
421
421
  try {
422
- this.handleDaoPromise(this.daoFactory(this.credentials, this.connection, this))
422
+ const promise = this.daoFactory(this.credentials, this.connection, this)
423
+ if(promise) this.handleDaoPromise(promise)
423
424
  } catch(error) {
424
425
  return this.handleDaoFactoryError(error)
425
426
  }
@@ -430,6 +431,9 @@ class ReactiveServerConnection extends EventEmitter {
430
431
  try {
431
432
  const serialized = JSON.stringify(message)
432
433
  this.connection.write(serialized)
434
+ if(message.signal == 'error') {
435
+ debug("sending error", JSON.stringify(message, null, 2))
436
+ }
433
437
  } catch (error) {
434
438
  console.error("MESSAGE SERIALIZATION ERROR", error, "\nMessage: ", message)
435
439
  }
@@ -583,7 +587,7 @@ class ReactiveServerConnection extends EventEmitter {
583
587
  }
584
588
 
585
589
  handleGetMore(requestId, paths) {
586
- //console.log("REQ", requestId)
590
+ //console.log("REQ", requestId, paths)
587
591
  let fetchMap = new Map()
588
592
  let resultsMap = new Map()
589
593
  let results = []
package/lib/SimpleDao.js CHANGED
@@ -3,7 +3,7 @@ const ObservablePromiseProxy = require("./ObservablePromiseProxy.js")
3
3
  const ObservableError = require("./ObservableError.js")
4
4
  const debug = require("debug")("reactive-dao")
5
5
 
6
- const errorMapper = e => ''+(e.stack || e.message || e)
6
+ const errorMapper = e => ''+(e.stack || e.message || (typeof e == 'object' ? JSON.stringify(e) : e))
7
7
 
8
8
  class SimpleDao {
9
9
 
package/package.json CHANGED
@@ -35,6 +35,6 @@
35
35
  "scripts": {
36
36
  "test": "NODE_ENV=test blue-tape tests/*"
37
37
  },
38
- "version": "0.5.8",
39
- "gitHead": "645fab4e2e100b75403f362145d0edf3583bca5d"
38
+ "version": "0.5.10",
39
+ "gitHead": "e6d34de6aa53390b8b5e5d78fe6493db6db6f3b2"
40
40
  }