mol_plot_all 1.2.1273 → 1.2.1275

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.js 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]() {