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.mjs 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
  }
package/node.test.js CHANGED
@@ -745,17 +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
- Error.captureStackTrace(result);
758
- handled.add(result);
754
+ result = result.then(put, put);
759
755
  }
760
756
  }
761
757
  catch (error) {
@@ -766,16 +762,20 @@ var $;
766
762
  result = new Error(String(error), { cause: error });
767
763
  }
768
764
  if ($mol_promise_like(result) && !handled.has(result)) {
769
- result = Object.assign(result.finally(() => {
765
+ result = result.finally(() => {
770
766
  if (this.cache === result)
771
767
  this.absorb();
772
- }), {
773
- destructor: result['destructor'] ?? (() => { })
774
768
  });
775
- Error.captureStackTrace(result);
776
- handled.add(result);
777
769
  }
778
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
+ }
779
779
  if (!$mol_promise_like(result)) {
780
780
  this.track_cut();
781
781
  }