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

throw grpc failed instead of invalid op on generic failure #7861

Closed
wants to merge 1 commit into from

Conversation

apolcyn
Copy link
Contributor

@apolcyn apolcyn commented Aug 24, 2016

It looks like there's been some desire to change the use of invalid operation exception on certain failures.

Making and throwing a new type here that extends InvalidOperationException to not make a breaking change. (under assumption users might currently catch InvalidOperationException).

This is mostly an initial idea to change it. I doesn't seem common to extend something other than Exception. Another idea was adding something new as the inner exception of InvalidOperationException, but seeing how this looked.

cc @jtattermusch @jskeet

@jskeet
Copy link
Contributor

jskeet commented Aug 25, 2016

What can cause these failures? They sound like IOExceptions just from a brief look at the code throwing them. But yes, that would be a breaking change...

@apolcyn
Copy link
Contributor Author

apolcyn commented Aug 25, 2016

It gets tricky I think because it looks like it can be thrown for invalid operation programming errors (e.g., calling requestStream.WriteAsync() after already calling requestStream.CompleteAsync()), but also for IO errors, like if WriteAsync() fails due to network error. Trying to keep the former but change the latter here.

@apolcyn
Copy link
Contributor Author

apolcyn commented Aug 30, 2016

It seems like extending the current exception would be too much of a breaking change? Closing this to not use the idea, guessing it might just cause problems.

using System;
namespace Grpc.Core
{
public class GrpcOperationFailedException : InvalidOperationException
Copy link
Contributor

Choose a reason for hiding this comment

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

FTR, we actually uses to have a similar exception type in a way earlier version of gRPC C# (pre-alpha), but then got rid of it.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants