mol_crypto_lib 0.1.1392 → 0.1.1393
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 +1 -1
- package/node.deps.json +1 -1
- package/node.js +23 -4
- package/node.js.map +1 -1
- package/node.mjs +23 -4
- package/node.test.js +23 -4
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.mjs
CHANGED
@@ -365,17 +365,36 @@ require = (req => Object.assign(function require(name) {
|
|
365
365
|
"use strict";
|
366
366
|
var $;
|
367
367
|
(function ($) {
|
368
|
+
function cause_serialize(cause) {
|
369
|
+
return JSON.stringify(cause, null, ' ')
|
370
|
+
.replace(/\(/, '<')
|
371
|
+
.replace(/\)/, ' >');
|
372
|
+
}
|
373
|
+
function frame_normalize(frame) {
|
374
|
+
return (typeof frame === 'string' ? frame : cause_serialize(frame))
|
375
|
+
.trim()
|
376
|
+
.replace(/at /gm, ' at ')
|
377
|
+
.replace(/^(?! +at )(.*)/gm, ' at | $1 (#)');
|
378
|
+
}
|
368
379
|
class $mol_error_mix extends AggregateError {
|
369
380
|
cause;
|
370
381
|
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
371
382
|
constructor(message, cause = {}, ...errors) {
|
372
383
|
super(errors, message, { cause });
|
373
384
|
this.cause = cause;
|
374
|
-
const
|
385
|
+
const desc = Object.getOwnPropertyDescriptor(this, 'stack');
|
386
|
+
const stack_get = () => desc?.get?.() ?? super.stack ?? desc?.value ?? this.message;
|
375
387
|
Object.defineProperty(this, 'stack', {
|
376
|
-
get: () =>
|
377
|
-
.
|
378
|
-
.
|
388
|
+
get: () => stack_get() + '\n' + [
|
389
|
+
this.cause ?? 'no cause',
|
390
|
+
...this.errors.flatMap(e => [
|
391
|
+
e.stack,
|
392
|
+
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
393
|
+
])
|
394
|
+
].map(frame_normalize).join('\n')
|
395
|
+
});
|
396
|
+
Object.defineProperty(this, 'cause', {
|
397
|
+
get: () => cause
|
379
398
|
});
|
380
399
|
}
|
381
400
|
static [Symbol.toPrimitive]() {
|
package/node.test.js
CHANGED
@@ -356,17 +356,36 @@ require = (req => Object.assign(function require(name) {
|
|
356
356
|
"use strict";
|
357
357
|
var $;
|
358
358
|
(function ($) {
|
359
|
+
function cause_serialize(cause) {
|
360
|
+
return JSON.stringify(cause, null, ' ')
|
361
|
+
.replace(/\(/, '<')
|
362
|
+
.replace(/\)/, ' >');
|
363
|
+
}
|
364
|
+
function frame_normalize(frame) {
|
365
|
+
return (typeof frame === 'string' ? frame : cause_serialize(frame))
|
366
|
+
.trim()
|
367
|
+
.replace(/at /gm, ' at ')
|
368
|
+
.replace(/^(?! +at )(.*)/gm, ' at | $1 (#)');
|
369
|
+
}
|
359
370
|
class $mol_error_mix extends AggregateError {
|
360
371
|
cause;
|
361
372
|
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
362
373
|
constructor(message, cause = {}, ...errors) {
|
363
374
|
super(errors, message, { cause });
|
364
375
|
this.cause = cause;
|
365
|
-
const
|
376
|
+
const desc = Object.getOwnPropertyDescriptor(this, 'stack');
|
377
|
+
const stack_get = () => desc?.get?.() ?? super.stack ?? desc?.value ?? this.message;
|
366
378
|
Object.defineProperty(this, 'stack', {
|
367
|
-
get: () =>
|
368
|
-
.
|
369
|
-
.
|
379
|
+
get: () => stack_get() + '\n' + [
|
380
|
+
this.cause ?? 'no cause',
|
381
|
+
...this.errors.flatMap(e => [
|
382
|
+
e.stack,
|
383
|
+
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
384
|
+
])
|
385
|
+
].map(frame_normalize).join('\n')
|
386
|
+
});
|
387
|
+
Object.defineProperty(this, 'cause', {
|
388
|
+
get: () => cause
|
370
389
|
});
|
371
390
|
}
|
372
391
|
static [Symbol.toPrimitive]() {
|