mol_wire_lib 1.0.966 → 1.0.968

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": "mol_wire_lib",
3
- "version": "1.0.966",
3
+ "version": "1.0.968",
4
4
  "exports": {
5
5
  "node": {
6
6
  "import": "./node.mjs",
package/web.js CHANGED
@@ -760,17 +760,13 @@ var $;
760
760
  result = this.task.call(this.host, ...this.args);
761
761
  break;
762
762
  }
763
- if ($mol_promise_like(result)) {
763
+ if ($mol_promise_like(result) && !handled.has(result)) {
764
764
  const put = (res) => {
765
765
  if (this.cache === result)
766
766
  this.put(res);
767
767
  return res;
768
768
  };
769
- result = Object.assign(result.then(put, put), {
770
- destructor: result['destructor'] ?? (() => { })
771
- });
772
- Error.captureStackTrace(result);
773
- handled.add(result);
769
+ result = result.then(put, put);
774
770
  }
775
771
  }
776
772
  catch (error) {
@@ -781,16 +777,20 @@ var $;
781
777
  result = new Error(String(error), { cause: error });
782
778
  }
783
779
  if ($mol_promise_like(result) && !handled.has(result)) {
784
- result = Object.assign(result.finally(() => {
780
+ result = result.finally(() => {
785
781
  if (this.cache === result)
786
782
  this.absorb();
787
- }), {
788
- destructor: result['destructor'] ?? (() => { })
789
783
  });
790
- Error.captureStackTrace(result);
791
- handled.add(result);
792
784
  }
793
785
  }
786
+ if ($mol_promise_like(result) && !handled.has(result)) {
787
+ result = Object.assign(result, {
788
+ destructor: result['destructor'] ?? (() => { })
789
+ });
790
+ handled.add(result);
791
+ const error = new Error();
792
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
793
+ }
794
794
  if (!$mol_promise_like(result)) {
795
795
  this.track_cut();
796
796
  }