@toa.io/core 1.0.0-alpha.73 → 1.0.0-alpha.75

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/core",
3
- "version": "1.0.0-alpha.73",
3
+ "version": "1.0.0-alpha.75",
4
4
  "description": "Toa Core",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -26,5 +26,5 @@
26
26
  "error-value": "0.3.0",
27
27
  "openspan": "1.0.0-alpha.73"
28
28
  },
29
- "gitHead": "3c7d415c68324aae8f1524b2ae06b02eb5832c54"
29
+ "gitHead": "5050fff4a676bbcd7b6f89c1788411701b7ecba6"
30
30
  }
package/src/component.js CHANGED
@@ -1,7 +1,8 @@
1
1
  'use strict'
2
2
 
3
- const { Connector } = require('./connector')
4
3
  const assert = require('node:assert')
4
+ const { console } = require('openspan')
5
+ const { Connector } = require('./connector')
5
6
 
6
7
  class Component extends Connector {
7
8
  locator
@@ -22,7 +23,15 @@ class Component extends Connector {
22
23
  assert.ok(endpoint in this.operations,
23
24
  `Endpoint '${endpoint}' is not provided by '${this.locator.id}'`)
24
25
 
25
- return this.operations[endpoint].invoke(request)
26
+ const reply = await this.operations[endpoint].invoke(request)
27
+
28
+ if (reply?.exception !== undefined)
29
+ console.error('Failed to execute operation', {
30
+ endpoint: `${this.locator.id}.${endpoint}`,
31
+ exception: reply.exception
32
+ })
33
+
34
+ return reply
26
35
  }
27
36
  }
28
37
 
package/src/operation.js CHANGED
@@ -42,8 +42,6 @@ class Operation extends Connector {
42
42
 
43
43
  return await this.process(store)
44
44
  } catch (e) {
45
- console.error('Failed to execute operation', e)
46
-
47
45
  const exception = e instanceof Error ? new SystemException(e) : e
48
46
 
49
47
  return { exception }