hyoo_sync_client 0.0.355 → 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/node.d.ts +2 -2
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +7 -1
- package/node.js.map +1 -1
- package/node.mjs +7 -1
- package/node.test.js +9 -3
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +2 -2
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +4 -2
- package/web.js.map +1 -1
- package/web.mjs +4 -2
- package/web.test.js +2 -2
- package/web.test.js.map +1 -1
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
|
|
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',
|
|
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',
|
|
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) {
|