Skip to content

Commit 48bed22

Browse files
committed
fix yet another value references in error messages
1 parent a41ba7a commit 48bed22

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

packages/kbn-config-schema/src/duration/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function stringToDuration(text: string) {
2828
const number = Number(text);
2929
if (typeof number !== 'number' || isNaN(number)) {
3030
throw new Error(
31-
`Failed to parse [${text}] as time value. Value must be a duration in milliseconds, or follow the format ` +
31+
`Failed to parse value as time value. Value must be a duration in milliseconds, or follow the format ` +
3232
`<count>[ms|s|m|h|d|w|M|Y] (e.g. '70ms', '5s', '3d', '1Y'), where the duration is a safe positive integer.`
3333
);
3434
}

packages/kbn-config-schema/src/types/array_type.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test('fails if wrong input type', () => {
3939
test('fails if string input cannot be parsed', () => {
4040
const type = schema.arrayOf(schema.string());
4141
expect(() => type.validate('test')).toThrowErrorMatchingInlineSnapshot(
42-
`"could not parse array value from [test]"`
42+
`"could not parse array value from json input"`
4343
);
4444
});
4545

@@ -53,7 +53,7 @@ test('fails with correct type if parsed input is not an array', () => {
5353
test('includes namespace in failure when wrong top-level type', () => {
5454
const type = schema.arrayOf(schema.string());
5555
expect(() => type.validate('test', {}, 'foo-namespace')).toThrowErrorMatchingInlineSnapshot(
56-
`"[foo-namespace]: could not parse array value from [test]"`
56+
`"[foo-namespace]: could not parse array value from json input"`
5757
);
5858
});
5959

packages/kbn-config-schema/src/types/array_type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class ArrayType<T> extends Type<T[]> {
5252
case 'array.sparse':
5353
return `sparse array are not allowed`;
5454
case 'array.parse':
55-
return `could not parse array value from [${value}]`;
55+
return `could not parse array value from json input`;
5656
case 'array.min':
5757
return `array size is [${value.length}], but cannot be smaller than [${limit}]`;
5858
case 'array.max':

packages/kbn-config-schema/src/types/duration_type.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ test('returns error when not valid string or non-safe positive integer', () => {
172172
);
173173

174174
expect(() => duration().validate('123foo')).toThrowErrorMatchingInlineSnapshot(
175-
`"Failed to parse [123foo] as time value. Value must be a duration in milliseconds, or follow the format <count>[ms|s|m|h|d|w|M|Y] (e.g. '70ms', '5s', '3d', '1Y'), where the duration is a safe positive integer."`
175+
`"Failed to parse value as time value. Value must be a duration in milliseconds, or follow the format <count>[ms|s|m|h|d|w|M|Y] (e.g. '70ms', '5s', '3d', '1Y'), where the duration is a safe positive integer."`
176176
);
177177

178178
expect(() => duration().validate('123 456')).toThrowErrorMatchingInlineSnapshot(
179-
`"Failed to parse [123 456] as time value. Value must be a duration in milliseconds, or follow the format <count>[ms|s|m|h|d|w|M|Y] (e.g. '70ms', '5s', '3d', '1Y'), where the duration is a safe positive integer."`
179+
`"Failed to parse value as time value. Value must be a duration in milliseconds, or follow the format <count>[ms|s|m|h|d|w|M|Y] (e.g. '70ms', '5s', '3d', '1Y'), where the duration is a safe positive integer."`
180180
);
181181
});

0 commit comments

Comments
 (0)