From c915f4f30f499f713582cc7f5647a7822b3f9c09 Mon Sep 17 00:00:00 2001 From: Mark Dumay Date: Sun, 4 Feb 2024 07:19:25 +0100 Subject: [PATCH 1/2] fix: correct out of range error message --- layouts/partials/utilities/IsInvalidArgs.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/partials/utilities/IsInvalidArgs.html b/layouts/partials/utilities/IsInvalidArgs.html index 392113b..ef65250 100644 --- a/layouts/partials/utilities/IsInvalidArgs.html +++ b/layouts/partials/utilities/IsInvalidArgs.html @@ -104,12 +104,12 @@ {{ end }} {{ else if and $def.options.min (in (slice "int" "float" "float64") $actual) }} {{ if lt $val $def.options.min }} - {{ warnf "[%s] argument '%s': value '%s' out of range [$d, $d]" $structure (string $key) $val $def.options.min $def.options.max}} + {{ warnf "[%s] argument '%s': value '%s' out of range [%d, %d]" $structure (string $key) (string $val) $def.options.min $def.options.max}} {{ $error = true }} {{ end }} {{ else if and $def.options.max (in (slice "int" "float" "float64") $actual) }} {{ if (gt $val $def.options.max) }} - {{ warnf "[%s] argument '%s': value '%s' out of range [$d, $d]" $structure (string $key) $val $def.options.min $def.options.max}} + {{ warnf "[%s] argument '%s': value '%s' out of range [%d, %d]" $structure (string $key) (string $val) $def.options.min $def.options.max}} {{ $error = true }} {{ end }} {{ end }} From 6cda2a87cb88868814dceb01b49ae1ebb6ddeaa5 Mon Sep 17 00:00:00 2001 From: Mark Dumay Date: Sun, 4 Feb 2024 07:34:22 +0100 Subject: [PATCH 2/2] fix: correct out of range error --- layouts/partials/utilities/IsInvalidArgs.html | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/layouts/partials/utilities/IsInvalidArgs.html b/layouts/partials/utilities/IsInvalidArgs.html index ef65250..84fa198 100644 --- a/layouts/partials/utilities/IsInvalidArgs.html +++ b/layouts/partials/utilities/IsInvalidArgs.html @@ -102,16 +102,11 @@ {{ warnf "[%s] argument '%s': unexpected value '%s'" $structure (string $key) $val }} {{ $error = true }} {{ end }} - {{ else if and $def.options.min (in (slice "int" "float" "float64") $actual) }} - {{ if lt $val $def.options.min }} + {{ else if and (or $def.options.min $def.options.max) (in (slice "int" "float" "float64") $actual) }} + {{ if or (lt $val $def.options.min) (gt $val $def.options.max) }} {{ warnf "[%s] argument '%s': value '%s' out of range [%d, %d]" $structure (string $key) (string $val) $def.options.min $def.options.max}} {{ $error = true }} - {{ end }} - {{ else if and $def.options.max (in (slice "int" "float" "float64") $actual) }} - {{ if (gt $val $def.options.max) }} - {{ warnf "[%s] argument '%s': value '%s' out of range [%d, %d]" $structure (string $key) (string $val) $def.options.min $def.options.max}} - {{ $error = true }} - {{ end }} + {{ end }} {{ end }} {{ end }} {{ end }}