@live-change/dao 0.8.49 → 0.8.51

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.
@@ -3,6 +3,7 @@ import ObservableList from "./ObservableList.js"
3
3
  import * as utils from './utils.js'
4
4
  import collectPointers from './collectPointers.js'
5
5
  import Debug from 'debug'
6
+ import { errorToJSON } from './utils.js'
6
7
  const debug = Debug("reactive-dao")
7
8
  const debugPot = Debug("reactive-dao:pot")
8
9
 
@@ -567,25 +568,19 @@ class ReactiveServerConnection extends EventEmitter {
567
568
  }
568
569
 
569
570
 
570
- handleGet(message) {
571
+ async handleGet(message) {
571
572
  const path = message.what
572
573
  if(typeof path == 'object' && !Array.isArray(path) && path.paths) {
573
574
  let paths = path.paths
574
575
  return this.handleGetMore(message.requestId, paths)
575
576
  }
576
577
  try {
577
- Promise.resolve(this.dao.get(path)).then(
578
- result => this.send({
579
- type: "response",
580
- responseId: message.requestId,
581
- response: result
582
- }),
583
- error => this.send({
584
- type: "error",
585
- responseId: message.requestId,
586
- error: utils.errorToJSON(error)
587
- })
588
- )
578
+ const result = await Promise.resolve(this.dao.get(path))
579
+ this.send({
580
+ type: "response",
581
+ responseId: message.requestId,
582
+ response: result
583
+ })
589
584
  } catch (error) {
590
585
  this.handleServerError(message, error)
591
586
  this.send({
@@ -657,7 +652,7 @@ class ReactiveServerConnection extends EventEmitter {
657
652
  if(!resultsMap.has(key)) {
658
653
  const resultInfo = {
659
654
  what,
660
- error: error
655
+ error: errorToJSON(error)
661
656
  }
662
657
  results.push(resultInfo)
663
658
  resultsMap.set(key, resultInfo)
package/package.json CHANGED
@@ -35,6 +35,6 @@
35
35
  "scripts": {
36
36
  "test": "NODE_ENV=test tape tests/*"
37
37
  },
38
- "version": "0.8.49",
39
- "gitHead": "568f730f1c8a6ce0247d1d8e49fcea110604800c"
38
+ "version": "0.8.51",
39
+ "gitHead": "ba8da813894eeb717223aa8d5e364649e4ac0347"
40
40
  }