@hatchet-dev/typescript-sdk 0.15.1-alpha3 → 0.15.1-alpha5

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.
@@ -84,17 +84,20 @@ class EventClient {
84
84
  }
85
85
  putLog(stepRunId, log, level) {
86
86
  const createdAt = new Date();
87
- (0, retrier_1.retrier)(() => __awaiter(this, void 0, void 0, function* () {
88
- return this.client.putLog({
89
- stepRunId,
90
- createdAt,
91
- message: log,
92
- level: level || LogLevel.INFO,
93
- });
94
- }), this.logger).catch((e) => {
95
- // log a warning, but this is not a fatal error
96
- this.logger.warn(`Could not put log: ${e.message.substring(0, 100)}`);
97
- });
87
+ // retrier(
88
+ // async () =>
89
+ // this.client.putLog({
90
+ // stepRunId,
91
+ // createdAt,
92
+ // message: log,
93
+ // level: level || LogLevel.INFO,
94
+ // }),
95
+ // this.logger
96
+ // ).catch((e: any) => {
97
+ // // log a warning, but this is not a fatal error
98
+ // console.error(e);
99
+ // // this.logger.warn(`Could not put log: ${e.message.substring(0, 100)}`);
100
+ // });
98
101
  }
99
102
  putStream(stepRunId, data) {
100
103
  const createdAt = new Date();
@@ -189,16 +189,16 @@ class Worker {
189
189
  delete this.futures[action.stepRunId];
190
190
  }
191
191
  catch (actionEventError) {
192
- this.logger.error(`Could not send completed action event: ${actionEventError.message}`);
192
+ this.logger.error(`Could not send completed action event: ${actionEventError.message || actionEventError}`);
193
193
  // send a failure event
194
194
  const failureEvent = this.getStepActionEvent(action, dispatcher_1.StepActionEventType.STEP_EVENT_TYPE_FAILED, actionEventError.message);
195
195
  try {
196
196
  yield this.client.dispatcher.sendStepActionEvent(failureEvent);
197
197
  }
198
198
  catch (failureEventError) {
199
- this.logger.error(`Could not send failed action event: ${failureEventError.message}`);
199
+ this.logger.error(`Could not send failed action event: ${failureEventError.message || failureEventError}`);
200
200
  }
201
- this.logger.error(`Could not send action event: ${actionEventError.message}`);
201
+ this.logger.error(`Could not send action event: ${actionEventError.message || actionEventError}`);
202
202
  }
203
203
  });
204
204
  const failure = (error) => __awaiter(this, void 0, void 0, function* () {
@@ -237,10 +237,15 @@ class Worker {
237
237
  this.client.dispatcher.sendStepActionEvent(event).catch((e) => {
238
238
  this.logger.error(`Could not send action event: ${e.message}`);
239
239
  });
240
- yield future.promise;
240
+ try {
241
+ yield future.promise;
242
+ }
243
+ catch (e) {
244
+ this.logger.error(`Could not wait for step run to finish: ${e}`);
245
+ }
241
246
  }
242
247
  catch (e) {
243
- this.logger.error(`Could not send action event: ${e.message}`);
248
+ this.logger.error(`Could not send action event (outer): ${e}`);
244
249
  }
245
250
  });
246
251
  }
@@ -356,7 +361,7 @@ class Worker {
356
361
  }
357
362
  }
358
363
  catch (e) {
359
- this.logger.error(`Could not cancel step run: ${e.message}`);
364
+ this.logger.error(`Could not cancel step run: ${e}`);
360
365
  }
361
366
  });
362
367
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hatchet-dev/typescript-sdk",
3
- "version": "0.15.1-alpha3",
3
+ "version": "0.15.1-alpha5",
4
4
  "description": "Background task orchestration & visibility for developers",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
package/util/retrier.js CHANGED
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.retrier = retrier;
16
16
  const sleep_1 = __importDefault(require("./sleep"));
17
- const DEFAULT_RETRY_INTERVAL = 0.1; // seconds
17
+ const DEFAULT_RETRY_INTERVAL = 0.1; // seconds
18
18
  const DEFAULT_RETRY_COUNT = 8;
19
19
  const MAX_JITTER = 400; // milliseconds
20
20
  function retrier(fn_1, logger_1) {