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

Consolidate/refactor local exceptions in C# #2338

Merged
merged 22 commits into from
Jun 25, 2024

Conversation

bernardnormier
Copy link
Member

This PR reworks the local exceptions in C#. It should be a model for the other language mappings.

In particular:

  • it reduces the number of local exceptions
  • all local exceptions are now read-only
  • most local exceptions have now no field - only the message and inner exception provided by System.Exception

{
}

public override string ice_id() => "::Ice::ObjectNotExistException";
Copy link
Member Author

Choose a reason for hiding this comment

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

We use ice_id for metrics and more.

- Consolidate and refactor the exceptions derived from LocalException.
| Local exception in Ice 3.7 | Replacement |
|-------------------------------------|----------------------------|
| BadMagicException | ProtocolException (base) |
Copy link
Member Author

Choose a reason for hiding this comment

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

Also useful as a guide when updating other language mappings.

setState(StateClosed,
new ConnectionAbortedException(
"Connection close forcefully by the application.",
closedByApplication: true));
Copy link
Member

Choose a reason for hiding this comment

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

Is closeByApplication ever false?

Copy link
Member Author

@bernardnormier bernardnormier Jun 24, 2024

Choose a reason for hiding this comment

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

Not currently - this exception is only thrown when the application aborts the connection "manually".

We need t closedByApplication to not retry a connection that was closed manually - that's the existing retry logic.

What about replacing ConnectionIdleException by ConnectionAbortedException with message + closedByApplication = false?

ConnectionLostException (a SocketException) also means "connection aborted". Should we replace it by ConnectionAbortedException?

All for a follow-up PR.

csharp/src/Ice/SSL/TrustManager.cs Outdated Show resolved Hide resolved
csharp/src/IceBox/Service.cs Outdated Show resolved Hide resolved
@bernardnormier bernardnormier merged commit 0831ab1 into zeroc-ice:main Jun 25, 2024
17 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