mol_tree2 1.0.650 → 1.0.652

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.test.js CHANGED
@@ -4630,17 +4630,13 @@ var $;
4630
4630
  result = this.task.call(this.host, ...this.args);
4631
4631
  break;
4632
4632
  }
4633
- if ($mol_promise_like(result)) {
4633
+ if ($mol_promise_like(result) && !handled.has(result)) {
4634
4634
  const put = (res) => {
4635
4635
  if (this.cache === result)
4636
4636
  this.put(res);
4637
4637
  return res;
4638
4638
  };
4639
- result = Object.assign(result.then(put, put), {
4640
- destructor: result['destructor'] ?? (() => { })
4641
- });
4642
- Error.captureStackTrace(result);
4643
- handled.add(result);
4639
+ result = result.then(put, put);
4644
4640
  }
4645
4641
  }
4646
4642
  catch (error) {
@@ -4651,16 +4647,20 @@ var $;
4651
4647
  result = new Error(String(error), { cause: error });
4652
4648
  }
4653
4649
  if ($mol_promise_like(result) && !handled.has(result)) {
4654
- result = Object.assign(result.finally(() => {
4650
+ result = result.finally(() => {
4655
4651
  if (this.cache === result)
4656
4652
  this.absorb();
4657
- }), {
4658
- destructor: result['destructor'] ?? (() => { })
4659
4653
  });
4660
- Error.captureStackTrace(result);
4661
- handled.add(result);
4662
4654
  }
4663
4655
  }
4656
+ if ($mol_promise_like(result) && !handled.has(result)) {
4657
+ result = Object.assign(result, {
4658
+ destructor: result['destructor'] ?? (() => { })
4659
+ });
4660
+ handled.add(result);
4661
+ const error = new Error();
4662
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
4663
+ }
4664
4664
  if (!$mol_promise_like(result)) {
4665
4665
  this.track_cut();
4666
4666
  }