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

Improve Config Parsing Exceptions #1194

Closed
TimothyMothra opened this issue Aug 21, 2019 · 5 comments
Closed

Improve Config Parsing Exceptions #1194

TimothyMothra opened this issue Aug 21, 2019 · 5 comments
Assignees
Milestone

Comments

@TimothyMothra
Copy link
Member

Can we please change TelemetryConfigurationFactory to include the property name when it fails to parse a value from the configuration file.

Actual Exception:
System.FormatException: 'Input string was not in a correct format.'

Expected Exception:
Exception: Failed to parse 'MaxTransmissionBufferCapacity' Reason: 'Input string was not in a correct format'
Inner Exception: System.FormatException: 'Input string was not in a correct format.'

@cijothomas
Copy link
Contributor

Where will user see this Exception?

@TimothyMothra
Copy link
Member Author

it currently throws the FormatException in the user code when the config file is first parsed.

A sample app (see code sample) will throw on line 3 when it initializes a TelemetryClient.

        static void Main(string[] args)
        {
            var tc = new TelemetryClient();
            tc.TrackTrace("this is a test");
        }

@cijothomas
Copy link
Contributor

i see. I never knew SDK would actually throw an exception but instead log to EventSource.
So now the proposed change throws a better exception, right/

@TimothyMothra
Copy link
Member Author

Exactly. I'm just replacing an exception that is already thrown with more meaningful details.

@cijothomas
Copy link
Contributor

Thanks for clarifying!

@cijothomas cijothomas added this to the 2.11 milestone Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants