Skip to content

Commit fa105f9

Browse files
committed
fix(dynamite_runtime): Fix minLength/maxLength error messages
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent 6472e4e commit fa105f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/dynamite/dynamite_runtime/lib/src/utils/string_checker.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ void checkPattern(String? input, RegExp pattern, String parameterName) {
1212
/// Throws an `Exception` containing the [parameterName] if the `input` is to short.
1313
void checkMinLength(String? input, int minLength, String parameterName) {
1414
if (input != null && input.length < minLength) {
15-
throw FormatException('Parameter "$input" has to be at least $minLength characters long');
15+
throw FormatException(
16+
'Parameter "$parameterName" has to be at least $minLength characters long but was ${input.length} long',
17+
);
1618
}
1719
}
1820

@@ -21,6 +23,8 @@ void checkMinLength(String? input, int minLength, String parameterName) {
2123
/// Throws an `Exception` containing the [parameterName] if the `input` is to long.
2224
void checkMaxLength(String? input, int maxLength, String parameterName) {
2325
if (input != null && input.length > maxLength) {
24-
throw FormatException('Parameter "$input" has to be at most $maxLength characters long');
26+
throw FormatException(
27+
'Parameter "$parameterName" has to be at most $maxLength characters long but was ${input.length} long',
28+
);
2529
}
2630
}

0 commit comments

Comments
 (0)