Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(dynamite_runtime): Fix minLength/maxLength error messages
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Apr 25, 2024
commit fa105f9509992c2ae2cc5f65a369fa5f794557c2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ void checkPattern(String? input, RegExp pattern, String parameterName) {
/// Throws an `Exception` containing the [parameterName] if the `input` is to short.
void checkMinLength(String? input, int minLength, String parameterName) {
if (input != null && input.length < minLength) {
throw FormatException('Parameter "$input" has to be at least $minLength characters long');
throw FormatException(
'Parameter "$parameterName" has to be at least $minLength characters long but was ${input.length} long',
);
}
}

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