mol_wire_lib 1.0.967 → 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/node.mjs CHANGED
@@ -754,16 +754,13 @@ var $;
754
754
  result = this.task.call(this.host, ...this.args);
755
755
  break;
756
756
  }
757
- if ($mol_promise_like(result)) {
757
+ if ($mol_promise_like(result) && !handled.has(result)) {
758
758
  const put = (res) => {
759
759
  if (this.cache === result)
760
760
  this.put(res);
761
761
  return res;
762
762
  };
763
- result = Object.assign(result.then(put, put), {
764
- destructor: result['destructor'] ?? (() => { })
765
- });
766
- handled.add(result);
763
+ result = result.then(put, put);
767
764
  }
768
765
  }
769
766
  catch (error) {
@@ -774,15 +771,20 @@ var $;
774
771
  result = new Error(String(error), { cause: error });
775
772
  }
776
773
  if ($mol_promise_like(result) && !handled.has(result)) {
777
- result = Object.assign(result.finally(() => {
774
+ result = result.finally(() => {
778
775
  if (this.cache === result)
779
776
  this.absorb();
780
- }), {
781
- destructor: result['destructor'] ?? (() => { })
782
777
  });
783
- handled.add(result);
784
778
  }
785
779
  }
780
+ if ($mol_promise_like(result) && !handled.has(result)) {
781
+ result = Object.assign(result, {
782
+ destructor: result['destructor'] ?? (() => { })
783
+ });
784
+ handled.add(result);
785
+ const error = new Error();
786
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
787
+ }
786
788
  if (!$mol_promise_like(result)) {
787
789
  this.track_cut();
788
790
  }
package/node.test.js CHANGED
@@ -745,16 +745,13 @@ var $;
745
745
  result = this.task.call(this.host, ...this.args);
746
746
  break;
747
747
  }
748
- if ($mol_promise_like(result)) {
748
+ if ($mol_promise_like(result) && !handled.has(result)) {
749
749
  const put = (res) => {
750
750
  if (this.cache === result)
751
751
  this.put(res);
752
752
  return res;
753
753
  };
754
- result = Object.assign(result.then(put, put), {
755
- destructor: result['destructor'] ?? (() => { })
756
- });
757
- handled.add(result);
754
+ result = result.then(put, put);
758
755
  }
759
756
  }
760
757
  catch (error) {
@@ -765,15 +762,20 @@ var $;
765
762
  result = new Error(String(error), { cause: error });
766
763
  }
767
764
  if ($mol_promise_like(result) && !handled.has(result)) {
768
- result = Object.assign(result.finally(() => {
765
+ result = result.finally(() => {
769
766
  if (this.cache === result)
770
767
  this.absorb();
771
- }), {
772
- destructor: result['destructor'] ?? (() => { })
773
768
  });
774
- handled.add(result);
775
769
  }
776
770
  }
771
+ if ($mol_promise_like(result) && !handled.has(result)) {
772
+ result = Object.assign(result, {
773
+ destructor: result['destructor'] ?? (() => { })
774
+ });
775
+ handled.add(result);
776
+ const error = new Error();
777
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
778
+ }
777
779
  if (!$mol_promise_like(result)) {
778
780
  this.track_cut();
779
781
  }