mol_wire_lib 1.0.967 → 1.0.969

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.js 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
  }