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

fixing scenerio 3 of issue #3995 #4214

Merged
merged 2 commits into from
Sep 17, 2019
Merged

fixing scenerio 3 of issue #3995 #4214

merged 2 commits into from
Sep 17, 2019

Conversation

Lynx1820
Copy link
Contributor

@Lynx1820 Lynx1820 commented Sep 13, 2019

This fixes the issue #3995 scenario 3
I'm waiting to see what can be done about scenario 1(desired behavior not decided yet) and 2( can't replicate). Scenario 4 is not part of our code base.

In this commit, I have made the error comment more clear and switched the exception from an System.ArgumentOutOfRangeException to System.ArgumentNullException. ArgumentOutOfRangeException are reserved for signaling bad function parameters and thus doesn't make sense to use for signaling a missing column value.

So we can do the best job, please check:

  • There's a descriptive title that will make sense to other developers some time from now.
  • There's associated issues. All PR's should have issue(s) associated - unless a trivial self-evident change such as fixing a typo. You can use the format Fixes #nnnn in your description to cause GitHub to automatically close the issue(s) when your PR is merged.
  • Your change description explains what the change does, why you chose your approach, and anything else that reviewers should know.
  • You have included any necessary tests in the same PR.

@Lynx1820 Lynx1820 requested a review from a team as a code owner September 13, 2019 18:59
Copy link
Contributor

@harishsk harishsk left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -222,7 +222,8 @@ private protected override void CheckDataValid(IChannel ch, RoleMappedData data)
$"Label column '{labelCol.Name}' is of type '{labelType.RawType}', but must be Key or Single.");
}
// Check group types.
ch.CheckParam(data.Schema.Group.HasValue, nameof(data), "Need a group column.");
if(!data.Schema.Group.HasValue)
throw ch.ExceptValue(nameof(data.Schema.Group), "Group column is missing.") ;
Copy link

@yaeldekel yaeldekel Sep 15, 2019

Choose a reason for hiding this comment

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

if (!condition)
    throw ...

is the same as doing a check on condition.
#Resolved

Copy link
Contributor Author

@Lynx1820 Lynx1820 Sep 16, 2019

Choose a reason for hiding this comment

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

Hi Yael! Checkparam throws an ArgumentOutOfRangeException, I switched to checking manually, so I can throw a different type of exception. There's also a checkvalue function, but it only works for checking classes. #Resolved

@Lynx1820 Lynx1820 merged commit a22f30f into dotnet:master Sep 17, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants