diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-01-12 20:14:55 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-01-13 16:43:08 -0400 |
commit | 8e5e35be0411246cbbc2b2bdc4a93ca6b36b1337 (patch) | |
tree | 577c4ee31b23f333927f631756d500ccf365ed1c | |
parent | 9ab0f503d6d57b7476041fc891ae3b0760df75a3 (diff) |
cacheable-object: tread carefully in {*}PropertyValueError
-rw-r--r-- | src/data/cacheable-object.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/data/cacheable-object.js b/src/data/cacheable-object.js index 010d967a..774e695e 100644 --- a/src/data/cacheable-object.js +++ b/src/data/cacheable-object.js @@ -392,8 +392,22 @@ export class CacheableObjectPropertyValueError extends Error { [Symbol.for('hsmusic.aggregate.translucent')] = true; constructor(property, oldValue, newValue, options) { + let inspectOldValue, inspectNewValue; + + try { + inspectOldValue = inspect(oldValue); + } catch (error) { + inspectOldValue = colors.red(`(couldn't inspect)`); + } + + try { + inspectNewValue = inspect(newValue); + } catch (error) { + inspectNewValue = colors.red(`(couldn't inspect)`); + } + super( - `Error setting ${colors.green(property)} (${inspect(oldValue)} -> ${inspect(newValue)})`, + `Error setting ${colors.green(property)} (${inspectOldValue} -> ${inspectNewValue})`, options); this.property = property; |