hyoo_sync_client 0.0.355 → 0.0.357

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
@@ -999,9 +999,15 @@ var $;
999
999
  class $mol_error_mix extends AggregateError {
1000
1000
  cause;
1001
1001
  name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
1002
- constructor(message, cause, ...errors) {
1002
+ constructor(message, cause = {}, ...errors) {
1003
1003
  super(errors, message, { cause });
1004
1004
  this.cause = cause;
1005
+ const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
1006
+ Object.defineProperty(this, 'stack', {
1007
+ get: () => stack_get.call(this) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
1008
+ .replace(/at /gm, ' at ')
1009
+ .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
1010
+ });
1005
1011
  }
1006
1012
  }
1007
1013
  $.$mol_error_mix = $mol_error_mix;
package/node.test.js CHANGED
@@ -990,9 +990,15 @@ var $;
990
990
  class $mol_error_mix extends AggregateError {
991
991
  cause;
992
992
  name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
993
- constructor(message, cause, ...errors) {
993
+ constructor(message, cause = {}, ...errors) {
994
994
  super(errors, message, { cause });
995
995
  this.cause = cause;
996
+ const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
997
+ Object.defineProperty(this, 'stack', {
998
+ get: () => stack_get.call(this) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
999
+ .replace(/at /gm, ' at ')
1000
+ .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
1001
+ });
996
1002
  }
997
1003
  }
998
1004
  $.$mol_error_mix = $mol_error_mix;
@@ -5653,14 +5659,14 @@ var $;
5653
5659
  $mol_assert_equal(mix.name, 'Invalid_Error');
5654
5660
  },
5655
5661
  'simpe mix'() {
5656
- const mix = new $mol_error_mix('foo', null, new Error('bar'), new Error('lol'));
5662
+ const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
5657
5663
  $mol_assert_equal(mix.message, 'foo');
5658
5664
  $mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
5659
5665
  },
5660
5666
  'provide additional info'() {
5661
5667
  class Invalid extends $mol_error_mix {
5662
5668
  }
5663
- const mix = new $mol_error_mix('Wrong password', null, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
5669
+ const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
5664
5670
  const hints = [];
5665
5671
  if (mix instanceof $mol_error_mix) {
5666
5672
  for (const er of mix.errors) {