@jsii/runtime 1.67.0 → 1.68.0

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/host.js CHANGED
@@ -38,7 +38,7 @@ class KernelHost {
38
38
  function completeCallback() {
39
39
  const req = this.inout.read();
40
40
  if (!req || 'exit' in req) {
41
- throw new Error('Interrupted before callback returned');
41
+ throw new kernel_1.JsiiFault('Interrupted before callback returned');
42
42
  }
43
43
  // if this is a completion for the current callback, then we can
44
44
  // finally stop this nonsense and return the result.
@@ -46,7 +46,7 @@ class KernelHost {
46
46
  if ('complete' in completeReq &&
47
47
  completeReq.complete.cbid === callback.cbid) {
48
48
  if (completeReq.complete.err) {
49
- throw new Error(completeReq.complete.err);
49
+ throw new kernel_1.JsiiFault(completeReq.complete.err);
50
50
  }
51
51
  return completeReq.complete.result;
52
52
  }
@@ -74,10 +74,10 @@ class KernelHost {
74
74
  */
75
75
  processRequest(req, next, sync = false) {
76
76
  if ('callback' in req) {
77
- throw new Error('Unexpected `callback` result. This request should have been processed by a callback handler');
77
+ throw new kernel_1.JsiiFault('Unexpected `callback` result. This request should have been processed by a callback handler');
78
78
  }
79
79
  if (!('api' in req)) {
80
- throw new Error('Malformed request, "api" field is required');
80
+ throw new kernel_1.JsiiFault('Malformed request, "api" field is required');
81
81
  }
82
82
  const apiReq = req;
83
83
  const fn = this.findApi(apiReq.api);
@@ -127,7 +127,7 @@ class KernelHost {
127
127
  return next();
128
128
  function checkIfAsyncIsAllowed() {
129
129
  if (sync) {
130
- throw new Error('Cannot handle async operations while waiting for a sync callback to return');
130
+ throw new kernel_1.JsiiFault('Cannot handle async operations while waiting for a sync callback to return');
131
131
  }
132
132
  }
133
133
  }
@@ -142,10 +142,11 @@ class KernelHost {
142
142
  * Writes an "error" result to stdout.
143
143
  */
144
144
  writeError(error) {
145
- const res = { error: error.message, stack: undefined };
146
- if (!this.opts.noStack) {
147
- res.stack = error.stack;
148
- }
145
+ const res = {
146
+ error: error.message,
147
+ name: error.name,
148
+ stack: this.opts.noStack ? undefined : error.stack,
149
+ };
149
150
  this.inout.write(res);
150
151
  }
151
152
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsii/runtime",
3
- "version": "1.67.0",
3
+ "version": "1.68.0",
4
4
  "description": "jsii runtime kernel process",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -34,14 +34,14 @@
34
34
  "package": "package-js"
35
35
  },
36
36
  "dependencies": {
37
- "@jsii/kernel": "^1.67.0",
38
- "@jsii/check-node": "1.67.0",
39
- "@jsii/spec": "^1.67.0"
37
+ "@jsii/kernel": "^1.68.0",
38
+ "@jsii/check-node": "1.68.0",
39
+ "@jsii/spec": "^1.68.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@scope/jsii-calc-base": "^1.67.0",
43
- "@scope/jsii-calc-lib": "^1.67.0",
44
- "jsii-build-tools": "^1.67.0",
42
+ "@scope/jsii-calc-base": "^1.68.0",
43
+ "@scope/jsii-calc-lib": "^1.68.0",
44
+ "jsii-build-tools": "^1.68.0",
45
45
  "jsii-calc": "^3.20.120",
46
46
  "source-map-loader": "^4.0.0",
47
47
  "webpack": "^5.74.0",
@@ -1,8 +1,8 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`can load libraries from within a callback 1`] = `
4
- Object {
5
- "ok": Object {
4
+ {
5
+ "ok": {
6
6
  "assembly": "@scope/jsii-calc-base-of-base",
7
7
  "types": "*redacted*",
8
8
  },
@@ -10,8 +10,8 @@ Object {
10
10
  `;
11
11
 
12
12
  exports[`can load libraries from within a callback 2`] = `
13
- Object {
14
- "ok": Object {
13
+ {
14
+ "ok": {
15
15
  "assembly": "@scope/jsii-calc-base",
16
16
  "types": "*redacted*",
17
17
  },
@@ -19,8 +19,8 @@ Object {
19
19
  `;
20
20
 
21
21
  exports[`can load libraries from within a callback 3`] = `
22
- Object {
23
- "ok": Object {
22
+ {
23
+ "ok": {
24
24
  "assembly": "@scope/jsii-calc-lib",
25
25
  "types": "*redacted*",
26
26
  },
@@ -28,10 +28,10 @@ Object {
28
28
  `;
29
29
 
30
30
  exports[`can load libraries from within a callback 4`] = `
31
- Object {
32
- "ok": Object {
31
+ {
32
+ "ok": {
33
33
  "$jsii.byref": "Object@10000",
34
- "$jsii.interfaces": Array [
34
+ "$jsii.interfaces": [
35
35
  "@scope/jsii-calc-lib.IFriendly",
36
36
  ],
37
37
  },
@@ -39,16 +39,16 @@ Object {
39
39
  `;
40
40
 
41
41
  exports[`can load libraries from within a callback 5`] = `
42
- Object {
43
- "callback": Object {
42
+ {
43
+ "callback": {
44
44
  "cbid": "jsii::callback::20000",
45
45
  "cookie": undefined,
46
- "invoke": Object {
47
- "args": Array [],
46
+ "invoke": {
47
+ "args": [],
48
48
  "method": "hello",
49
- "objref": Object {
49
+ "objref": {
50
50
  "$jsii.byref": "Object@10000",
51
- "$jsii.interfaces": Array [
51
+ "$jsii.interfaces": [
52
52
  "@scope/jsii-calc-lib.IFriendly",
53
53
  ],
54
54
  },
@@ -58,8 +58,8 @@ Object {
58
58
  `;
59
59
 
60
60
  exports[`can load libraries from within a callback 6`] = `
61
- Object {
62
- "ok": Object {
61
+ {
62
+ "ok": {
63
63
  "assembly": "jsii-calc",
64
64
  "types": "*redacted*",
65
65
  },
@@ -67,8 +67,8 @@ Object {
67
67
  `;
68
68
 
69
69
  exports[`can load libraries from within a callback 7`] = `
70
- Object {
71
- "ok": Object {
70
+ {
71
+ "ok": {
72
72
  "result": "SUCCESS!",
73
73
  },
74
74
  }