hyoo_sync_client 0.0.374 → 0.0.376

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
@@ -2005,17 +2005,13 @@ var $;
2005
2005
  result = this.task.call(this.host, ...this.args);
2006
2006
  break;
2007
2007
  }
2008
- if ($mol_promise_like(result)) {
2008
+ if ($mol_promise_like(result) && !handled.has(result)) {
2009
2009
  const put = (res) => {
2010
2010
  if (this.cache === result)
2011
2011
  this.put(res);
2012
2012
  return res;
2013
2013
  };
2014
- result = Object.assign(result.then(put, put), {
2015
- destructor: result['destructor'] ?? (() => { })
2016
- });
2017
- Error.captureStackTrace(result);
2018
- handled.add(result);
2014
+ result = result.then(put, put);
2019
2015
  }
2020
2016
  }
2021
2017
  catch (error) {
@@ -2026,16 +2022,20 @@ var $;
2026
2022
  result = new Error(String(error), { cause: error });
2027
2023
  }
2028
2024
  if ($mol_promise_like(result) && !handled.has(result)) {
2029
- result = Object.assign(result.finally(() => {
2025
+ result = result.finally(() => {
2030
2026
  if (this.cache === result)
2031
2027
  this.absorb();
2032
- }), {
2033
- destructor: result['destructor'] ?? (() => { })
2034
2028
  });
2035
- Error.captureStackTrace(result);
2036
- handled.add(result);
2037
2029
  }
2038
2030
  }
2031
+ if ($mol_promise_like(result) && !handled.has(result)) {
2032
+ result = Object.assign(result, {
2033
+ destructor: result['destructor'] ?? (() => { })
2034
+ });
2035
+ handled.add(result);
2036
+ const error = new Error();
2037
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
2038
+ }
2039
2039
  if (!$mol_promise_like(result)) {
2040
2040
  this.track_cut();
2041
2041
  }