hyoo_sync_client 0.0.354 → 0.0.356

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/web.mjs CHANGED
@@ -349,12 +349,14 @@ var $;
349
349
  class $mol_error_mix extends AggregateError {
350
350
  cause;
351
351
  name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
352
- constructor(message, cause, ...errors) {
352
+ constructor(message, cause = {}, ...errors) {
353
353
  super(errors, message, { cause });
354
354
  this.cause = cause;
355
355
  const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
356
356
  Object.defineProperty(this, 'stack', {
357
- get: () => stack_get.call(this) + '\n' + this.errors.map(e => e.stack.trim().replace(/at /gm, ' at ').replace(/^(?! )(.*)/gm, ' at [$1] (#)')).join('\n')
357
+ get: () => stack_get.call(this) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
358
+ .replace(/at /gm, ' at ')
359
+ .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
358
360
  });
359
361
  }
360
362
  }
package/web.test.js CHANGED
@@ -859,14 +859,14 @@ var $;
859
859
  $mol_assert_equal(mix.name, 'Invalid_Error');
860
860
  },
861
861
  'simpe mix'() {
862
- const mix = new $mol_error_mix('foo', null, new Error('bar'), new Error('lol'));
862
+ const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
863
863
  $mol_assert_equal(mix.message, 'foo');
864
864
  $mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
865
865
  },
866
866
  'provide additional info'() {
867
867
  class Invalid extends $mol_error_mix {
868
868
  }
869
- 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' }));
869
+ 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' }));
870
870
  const hints = [];
871
871
  if (mix instanceof $mol_error_mix) {
872
872
  for (const er of mix.errors) {