@indra.ai/deva 1.5.32 → 1.5.33

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.
Files changed (2) hide show
  1. package/index.js +12 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1569,16 +1569,16 @@ class Deva {
1569
1569
  The error function provides the consistent error manage of the system.
1570
1570
  usage: this.error(err, data, reject);
1571
1571
  ***************/
1572
- error(err,data=false,reject=false) {
1572
+ error(err,packet,reject=false) {
1573
1573
  const id = this.lib.uid();
1574
1574
  this.zone('error', id);
1575
- this.action('error', id);
1576
- this.state('error', id);
1577
- this.context('error', id);
1578
-
1579
1575
  const agent = this.agent();
1580
1576
  const client = this.client();
1581
- const _data = {
1577
+
1578
+ this.action('error', id);
1579
+ const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1580
+
1581
+ const data = {
1582
1582
  id,
1583
1583
  key: 'error',
1584
1584
  value: agent.key,
@@ -1592,13 +1592,14 @@ class Deva {
1592
1592
  data,
1593
1593
  created: Date.now(),
1594
1594
  }
1595
- _data.hash = this.lib.hash(_data);
1596
- this.talk(config.events.error, this.lib.copy(_data));
1597
- const hasOnError = this.onError && typeof this.onError === 'function' ? true : false;
1595
+ data.hash = this.lib.hash(data);
1596
+ this.talk(config.events.error, this.lib.copy(data));
1598
1597
 
1599
1598
  this.state('return', `error:${id}`);
1600
- if (hasOnError) return this.onError(err, data, reject);
1601
- else return reject ? reject(err) : err;
1599
+ this.state('error', id);
1600
+ this.context('error', id);
1601
+ if (hasOnError) return this.onError(err, packet, reject);
1602
+ else return reject ? reject(err) : Promise.reject(err);
1602
1603
  }
1603
1604
 
1604
1605
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indra.ai/deva",
3
- "version": "1.5.32",
3
+ "version": "1.5.33",
4
4
  "description": "The Deva Core",
5
5
  "main": "index.js",
6
6
  "copyright": "(c)2025 Quinn Michaels; All rights reserved.",