Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dr2 2049 make number of displayed errors configurable #527

Merged
merged 5 commits into from
Jan 23, 2025

Conversation

techncl
Copy link
Contributor

@techncl techncl commented Jan 21, 2025

No description provided.

def rowCallback(row: ValidatedNel[FailMessage, Any]): Unit = row match {
val maxNumOfLines = Try(potentialMaxNumOfLines.toInt) match {
case Success(number) if number > 0 => number
case _ =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we error finding the limit, we should, perhaps, just go ahead with the current default limit of 2000 instead of setting it to zero. Maybe get Steve's opinion as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I set it to 0 here is so that on line 154, it can do the conditional check maxNumOfLines > 0 and not run the validation (after it sends the error message on line 151). Wouldn't it be better to just return an error rather than running the validation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking is, it becomes more restrictive than previous version, also if that setting is missing, the application can still carry on and succeed, hence the comment. Perhaps get Steve's opinion as well.

val maxNumOfLines = Try(potentialMaxNumOfLines.toInt) match {
case Success(number) if number > 0 => number
case _ =>
toConsole("Error: Maximum number of lines to display must be a positive whole number starting from 1")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a simpler message "should be more than zero" or something like that. Technically, "whole numbers" include zero

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes. 😄 I was going back and forth trying to make this message more succinct; yours is much better.

Copy link
Contributor

@sparkhi sparkhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments and one to seek another opinion.

@techncl techncl merged commit 4b6a2cd into master Jan 23, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants