@nice-code/action 0.2.7 → 0.2.8

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/build/index.js +18 -4
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -3482,7 +3482,10 @@ class ActionRouter {
3482
3482
  specifiedClient: this._context.runtime.coordinate
3483
3483
  });
3484
3484
  }
3485
- throw new Error(`No route function found for action with domain "${action.domain}" and id "${action.id}".`);
3485
+ throw err_nice_action.fromId("no_action_execution_handler" /* no_action_execution_handler */, {
3486
+ domain: action.domain,
3487
+ actionId: action.id
3488
+ });
3486
3489
  }
3487
3490
  getRouteDataEntriesForActionOrThrow(action, context) {
3488
3491
  const entries = this.getRouteDataEntriesForAction(action);
@@ -3605,7 +3608,9 @@ class ActionRuntime {
3605
3608
  }
3606
3609
  updateRuntimeCoordinate(newCoordinate) {
3607
3610
  if (this._coordinate.envId !== newCoordinate.envId) {
3608
- throw new Error(`Can't update Runtime Coordinate with different "envId" properties (static environment id). "${this.coordinate.envId}" (current) !== ${newCoordinate.envId}`);
3611
+ throw err_nice_action.fromId("not_implemented" /* not_implemented */, {
3612
+ label: `updating RuntimeCoordinate with a different "envId" ("${this._coordinate.envId}" → "${newCoordinate.envId}")`
3613
+ });
3609
3614
  }
3610
3615
  this._coordinate = newCoordinate;
3611
3616
  this.apply();
@@ -7182,7 +7187,14 @@ class TransportHttp extends Transport {
7182
7187
  if (timedOut) {
7183
7188
  throw err_nice_transport.fromId("timeout" /* timeout */, { timeout });
7184
7189
  }
7185
- throw err3;
7190
+ if (err3 instanceof NiceError) {
7191
+ throw err3;
7192
+ }
7193
+ throw err_nice_transport.fromId("send_failed" /* send_failed */, {
7194
+ actionState: action.type,
7195
+ actionId: action.id,
7196
+ message: err3 instanceof Error ? err3.message : String(err3)
7197
+ }).withOriginError(err3 instanceof Error ? err3 : undefined);
7186
7198
  } finally {
7187
7199
  clearTimeout(timeoutId);
7188
7200
  unsubscribe();
@@ -7389,7 +7401,9 @@ class ActionExternalClientHandler extends ActionHandler {
7389
7401
  } else if (def.type === "custom" /* custom */) {
7390
7402
  this.transportManager.addTransport(new TransportCustom(def));
7391
7403
  } else {
7392
- throw new Error(`Unsupported transport type: ${def.type}`);
7404
+ throw err_nice_action.fromId("not_implemented" /* not_implemented */, {
7405
+ label: `transport type "${def.type}"`
7406
+ });
7393
7407
  }
7394
7408
  }
7395
7409
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-code/action",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {