@wooksjs/event-wf 0.3.10 → 0.3.12

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/dist/index.cjs CHANGED
@@ -120,32 +120,39 @@ class WooksWf extends wooks.WooksAdapterBase {
120
120
  null;
121
121
  if (handlers && handlers.length) {
122
122
  let result = {};
123
- for (const handler of handlers) {
124
- restoreCtx();
125
- const { id, init } = (yield handler());
126
- if (init) {
127
- yield init();
123
+ try {
124
+ for (const handler of handlers) {
128
125
  restoreCtx();
129
- }
130
- if (resume) {
131
- result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
132
- break;
133
- }
134
- else {
135
- result = yield this.wf.start(id, inputContext, input);
136
- break;
126
+ const { id, init } = (yield handler());
127
+ if (init) {
128
+ restoreCtx();
129
+ yield init();
130
+ }
131
+ restoreCtx();
132
+ if (resume) {
133
+ result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
134
+ break;
135
+ }
136
+ else {
137
+ result = yield this.wf.start(id, inputContext, input);
138
+ break;
139
+ }
137
140
  }
138
141
  }
139
- if (cleanup) {
140
- restoreCtx();
141
- cleanup();
142
+ catch (e) {
143
+ clean();
144
+ throw e;
142
145
  }
146
+ clean();
143
147
  clearCtx();
144
148
  return result;
145
149
  }
146
- if (cleanup) {
147
- restoreCtx();
148
- cleanup();
150
+ clean();
151
+ function clean() {
152
+ if (cleanup) {
153
+ restoreCtx();
154
+ cleanup();
155
+ }
149
156
  }
150
157
  clearCtx();
151
158
  throw new Error('Unknown schemaId: ' + schemaId);
package/dist/index.mjs CHANGED
@@ -118,32 +118,39 @@ class WooksWf extends WooksAdapterBase {
118
118
  null;
119
119
  if (handlers && handlers.length) {
120
120
  let result = {};
121
- for (const handler of handlers) {
122
- restoreCtx();
123
- const { id, init } = (yield handler());
124
- if (init) {
125
- yield init();
121
+ try {
122
+ for (const handler of handlers) {
126
123
  restoreCtx();
127
- }
128
- if (resume) {
129
- result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
130
- break;
131
- }
132
- else {
133
- result = yield this.wf.start(id, inputContext, input);
134
- break;
124
+ const { id, init } = (yield handler());
125
+ if (init) {
126
+ restoreCtx();
127
+ yield init();
128
+ }
129
+ restoreCtx();
130
+ if (resume) {
131
+ result = yield this.wf.resume(id, { context: inputContext, indexes }, input);
132
+ break;
133
+ }
134
+ else {
135
+ result = yield this.wf.start(id, inputContext, input);
136
+ break;
137
+ }
135
138
  }
136
139
  }
137
- if (cleanup) {
138
- restoreCtx();
139
- cleanup();
140
+ catch (e) {
141
+ clean();
142
+ throw e;
140
143
  }
144
+ clean();
141
145
  clearCtx();
142
146
  return result;
143
147
  }
144
- if (cleanup) {
145
- restoreCtx();
146
- cleanup();
148
+ clean();
149
+ function clean() {
150
+ if (cleanup) {
151
+ restoreCtx();
152
+ cleanup();
153
+ }
147
154
  }
148
155
  clearCtx();
149
156
  throw new Error('Unknown schemaId: ' + schemaId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-wf",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "@wooksjs/event-wf",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -25,8 +25,8 @@
25
25
  "author": "Artem Maltsev",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
- "wooks": "0.3.10",
29
- "@wooksjs/event-core": "0.3.10"
28
+ "wooks": "0.3.12",
29
+ "@wooksjs/event-core": "0.3.12"
30
30
  },
31
31
  "dependencies": {
32
32
  "@prostojs/logger": "^0.3.6",