« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/html.js4
-rw-r--r--src/util/replacer.js4
-rw-r--r--src/util/sugar.js6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/util/html.js b/src/util/html.js
index c7395fbf..282a52da 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -2,7 +2,7 @@
 
 import {inspect} from 'node:util';
 
-import {empty} from '#sugar';
+import {empty, typeAppearance} from '#sugar';
 import * as commonValidators from '#validators';
 
 // COMPREHENSIVE!
@@ -633,7 +633,7 @@ export class Template {
 
   static validateDescription(description) {
     if (typeof description !== 'object') {
-      throw new TypeError(`Expected object, got ${typeof description}`);
+      throw new TypeError(`Expected object, got ${typeAppearance(description)}`);
     }
 
     if (description === null) {
diff --git a/src/util/replacer.js b/src/util/replacer.js
index 647d1f0e..095ee060 100644
--- a/src/util/replacer.js
+++ b/src/util/replacer.js
@@ -6,7 +6,7 @@
 // for embedding in a wiki webpage.
 
 import * as html from '#html';
-import {escapeRegex} from '#sugar';
+import {escapeRegex, typeAppearance} from '#sugar';
 
 // Syntax literals.
 const tagBeginning = '[[';
@@ -407,7 +407,7 @@ export function postprocessHeadings(inputNodes) {
 
 export function parseInput(input) {
   if (typeof input !== 'string') {
-    throw new TypeError(`Expected input to be string, got ${input}`);
+    throw new TypeError(`Expected input to be string, got ${typeAppearance(input)}`);
   }
 
   try {
diff --git a/src/util/sugar.js b/src/util/sugar.js
index ef6ab18c..29fcf848 100644
--- a/src/util/sugar.js
+++ b/src/util/sugar.js
@@ -82,7 +82,7 @@ export function stitchArrays(keyToArray) {
   for (const [key, value] of Object.entries(keyToArray)) {
     if (value === null) continue;
     if (Array.isArray(value)) continue;
-    errors.push(new TypeError(`(${key}) Expected array or null, got ${value}`));
+    errors.push(new TypeError(`(${key}) Expected array or null, got ${typeAppearance(value)}`));
   }
 
   if (!empty(errors)) {
@@ -170,11 +170,11 @@ export function setIntersection(set1, set2) {
 
 export function filterProperties(object, properties) {
   if (typeof object !== 'object' || object === null) {
-    throw new TypeError(`Expected object to be an object, got ${object}`);
+    throw new TypeError(`Expected object to be an object, got ${typeAppearance(object)}`);
   }
 
   if (!Array.isArray(properties)) {
-    throw new TypeError(`Expected properties to be an array, got ${properties}`);
+    throw new TypeError(`Expected properties to be an array, got ${typeAppearance(properties)}`);
   }
 
   const filteredObject = {};