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

Fail on unknown properties #2837

Merged
merged 4 commits into from
Oct 2, 2024
Merged

Fail on unknown properties #2837

merged 4 commits into from
Oct 2, 2024

Conversation

pepone
Copy link
Member

@pepone pepone commented Oct 2, 2024

This is the C# side of #2799

message.Append(prefix.AsSpan(0, prefix.Length - 1));
message.Append("':");
foreach (string p in unknownProps)
{
message.Append("\n ");
message.Append(p);
}
Ice.Util.getProcessLogger().warning(message.ToString());
throw new InvalidOperationException(message.ToString());
Copy link
Member Author

Choose a reason for hiding this comment

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

Not clear what is the more appropriate exception here, this can be called from the dispatch when metrics are updated using the metrics admin facet.

Copy link
Member

Choose a reason for hiding this comment

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

It should be a LocalException since we have a lot of code that expects only LocalException.

Copy link
Member

@bernardnormier bernardnormier left a comment

Choose a reason for hiding this comment

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

What about adding a new UnknownPropertyException local exception - similar to ParseException?

{
var initData = new InitializationData();
initData.properties = createTestProperties(ref args);
using (var communicator = initialize(initData))
Copy link
Member

Choose a reason for hiding this comment

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

Use a using declaration.

message.Append(prefix.AsSpan(0, prefix.Length - 1));
message.Append("':");
foreach (string p in unknownProps)
{
message.Append("\n ");
message.Append(p);
}
Ice.Util.getProcessLogger().warning(message.ToString());
throw new InvalidOperationException(message.ToString());
Copy link
Member

Choose a reason for hiding this comment

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

It should be a LocalException since we have a lot of code that expects only LocalException.

message.Append(prefix);
message.Append("':");
foreach (string s in unknownProps)
{
message.Append("\n ");
message.Append(s);
}
_instance.initializationData().logger.warning(message.ToString());
throw new InitializationException(message.ToString());
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's the right exception, and it can occur after communicator/OA initialization.

Copy link
Member

@externl externl left a comment

Choose a reason for hiding this comment

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

Looks good. What about Connection and ThreadPool properties?

@pepone
Copy link
Member Author

pepone commented Oct 2, 2024

Looks good. What about Connection and ThreadPool properties?

For now, I'm just replacing the usage of Ice.Warn.UnknownProperties and we don't have this check in thread pools.

@pepone pepone merged commit 3babd2e into zeroc-ice:main Oct 2, 2024
17 checks passed
InsertCreativityHere pushed a commit to InsertCreativityHere/compiler-comparison that referenced this pull request Jan 1, 2025
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.

3 participants