mol_plot_all 1.2.1274 → 1.2.1276

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
@@ -2051,17 +2051,36 @@ require = (req => Object.assign(function require(name) {
2051
2051
  "use strict";
2052
2052
  var $;
2053
2053
  (function ($) {
2054
+ function cause_serialize(cause) {
2055
+ return JSON.stringify(cause, null, ' ')
2056
+ .replace(/\(/, '<')
2057
+ .replace(/\)/, ' >');
2058
+ }
2059
+ function frame_normalize(frame) {
2060
+ return (typeof frame === 'string' ? frame : cause_serialize(frame))
2061
+ .trim()
2062
+ .replace(/at /gm, ' at ')
2063
+ .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)');
2064
+ }
2054
2065
  class $mol_error_mix extends AggregateError {
2055
2066
  cause;
2056
2067
  name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
2057
2068
  constructor(message, cause = {}, ...errors) {
2058
2069
  super(errors, message, { cause });
2059
2070
  this.cause = cause;
2060
- const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
2071
+ const desc = Object.getOwnPropertyDescriptor(this, 'stack');
2072
+ const stack_get = () => desc?.get?.() ?? super.stack ?? desc?.value ?? this.message;
2061
2073
  Object.defineProperty(this, 'stack', {
2062
- get: () => (stack_get.call(this) ?? this.message) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
2063
- .replace(/at /gm, ' at ')
2064
- .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
2074
+ get: () => stack_get() + '\n' + [
2075
+ this.cause ?? 'no cause',
2076
+ ...this.errors.flatMap(e => [
2077
+ e.stack,
2078
+ ...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
2079
+ ])
2080
+ ].map(frame_normalize).join('\n')
2081
+ });
2082
+ Object.defineProperty(this, 'cause', {
2083
+ get: () => cause
2065
2084
  });
2066
2085
  }
2067
2086
  static [Symbol.toPrimitive]() {
package/node.test.js CHANGED
@@ -2042,17 +2042,36 @@ require = (req => Object.assign(function require(name) {
2042
2042
  "use strict";
2043
2043
  var $;
2044
2044
  (function ($) {
2045
+ function cause_serialize(cause) {
2046
+ return JSON.stringify(cause, null, ' ')
2047
+ .replace(/\(/, '<')
2048
+ .replace(/\)/, ' >');
2049
+ }
2050
+ function frame_normalize(frame) {
2051
+ return (typeof frame === 'string' ? frame : cause_serialize(frame))
2052
+ .trim()
2053
+ .replace(/at /gm, ' at ')
2054
+ .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)');
2055
+ }
2045
2056
  class $mol_error_mix extends AggregateError {
2046
2057
  cause;
2047
2058
  name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
2048
2059
  constructor(message, cause = {}, ...errors) {
2049
2060
  super(errors, message, { cause });
2050
2061
  this.cause = cause;
2051
- const stack_get = Object.getOwnPropertyDescriptor(this, 'stack')?.get ?? (() => super.stack);
2062
+ const desc = Object.getOwnPropertyDescriptor(this, 'stack');
2063
+ const stack_get = () => desc?.get?.() ?? super.stack ?? desc?.value ?? this.message;
2052
2064
  Object.defineProperty(this, 'stack', {
2053
- get: () => (stack_get.call(this) ?? this.message) + '\n' + [JSON.stringify(this.cause, null, ' ') ?? 'no cause', ...this.errors.map(e => e.stack)].map(e => e.trim()
2054
- .replace(/at /gm, ' at ')
2055
- .replace(/^(?! +at )(.*)/gm, ' at | $1 (#)')).join('\n')
2065
+ get: () => stack_get() + '\n' + [
2066
+ this.cause ?? 'no cause',
2067
+ ...this.errors.flatMap(e => [
2068
+ e.stack,
2069
+ ...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
2070
+ ])
2071
+ ].map(frame_normalize).join('\n')
2072
+ });
2073
+ Object.defineProperty(this, 'cause', {
2074
+ get: () => cause
2056
2075
  });
2057
2076
  }
2058
2077
  static [Symbol.toPrimitive]() {