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/node.js CHANGED
@@ -754,17 +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
- Error.captureStackTrace(result);
767
- handled.add(result);
763
+ result = result.then(put, put);
768
764
  }
769
765
  }
770
766
  catch (error) {
@@ -775,16 +771,20 @@ var $;
775
771
  result = new Error(String(error), { cause: error });
776
772
  }
777
773
  if ($mol_promise_like(result) && !handled.has(result)) {
778
- result = Object.assign(result.finally(() => {
774
+ result = result.finally(() => {
779
775
  if (this.cache === result)
780
776
  this.absorb();
781
- }), {
782
- destructor: result['destructor'] ?? (() => { })
783
777
  });
784
- Error.captureStackTrace(result);
785
- handled.add(result);
786
778
  }
787
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
+ }
788
788
  if (!$mol_promise_like(result)) {
789
789
  this.track_cut();
790
790
  }