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

CSHARP-3037: Correcting types in ArgumentException message. #392

Closed
wants to merge 1 commit into from

Conversation

kevbite
Copy link
Contributor

@kevbite kevbite commented Feb 16, 2020

Fixing expectation message whereby the wrong type is contained within the exception making it confusing to the end-user.

Take for example the following test:

[Fact]
public void Test1()
{
    PipelineDefinition<BsonDocument, MyType>.Create(new IPipelineStageDefinition[]
    {
        new JsonPipelineStageDefinition<BsonDocument, BsonDocument>(
            @"{ project: { } } "),
    });
}

public class MyType { }

This throws the following exception


System.ArgumentException : The output type to the last stage was expected to be MongoDB.Bson.BsonDocument, but was MongoDB.Bson.BsonDocument. (Parameter 'stages')

instead of


System.ArgumentException : The output type to the last stage was expected to be SomeExample.MyType, but was MongoDB.Bson.BsonDocument. (Parameter 'stages')

@vincentkam
Copy link
Contributor

Created https://jira.mongodb.org/browse/CSHARP-3037 to track this 😺

@kevbite kevbite changed the title Correcting types in ArgumentException message. CSHARP-3037: Correcting types in ArgumentException message. Apr 1, 2020
@vincentkam
Copy link
Contributor

Thank for your PR @kevbite! I've merged your change with some small tweaks here: cddc136 😸

@vincentkam vincentkam closed this Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants