« get me outta code hell

data, test: type validation message adjustments - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-29 10:36:59 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-29 10:36:59 -0300
commite4dc2be4c12a5578bfb5d5945a592907aed1cb4f (patch)
tree71e3a201eba0889d1e912d5d049696f8a094bf09 /src
parent90492f9e58251f63a1175d0e52d76f00fa78e3bf (diff)
data, test: type validation message adjustments
Diffstat (limited to 'src')
-rw-r--r--src/data/things/composite.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/data/things/composite.js b/src/data/things/composite.js
index 7a3a8319..c03f8833 100644
--- a/src/data/things/composite.js
+++ b/src/data/things/composite.js
@@ -4,6 +4,7 @@ import {colors} from '#cli';
 import {TupleMap} from '#wiki-data';
 
 import {
+  a,
   is,
   isString,
   isWholeNumber,
@@ -464,8 +465,8 @@ function validateInputValue(value, description) {
     } else {
       throw new TypeError(
         (type
-          ? `Expected ${type}, got ${typeAppearance(value)}`
-          : `Expected value, got ${typeAppearance(value)}`));
+          ? `Expected ${a(type)}, got ${typeAppearance(value)}`
+          : `Expected a value, got ${typeAppearance(value)}`));
     }
   }
 
@@ -478,7 +479,7 @@ function validateInputValue(value, description) {
         : typeof value);
 
     if (typeofValue !== type) {
-      throw new TypeError(`Expected ${type}, got ${typeAppearance(value)}`);
+      throw new TypeError(`Expected ${a(type)}, got ${typeAppearance(value)}`);
     }
   }
 
@@ -1997,6 +1998,7 @@ export const withPropertiesFromObject = templateCompositeFrom({
     object: input({type: 'object', acceptsNull: true}),
 
     properties: input({
+      type: 'array',
       validate: validateArrayItems(isString),
     }),