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

Don't fatal on encoding errors #1025

Closed
wants to merge 1 commit into from

Conversation

menghanl
Copy link
Contributor

@menghanl menghanl commented Dec 19, 2016

Copy link
Contributor

@tamird tamird left a comment

Choose a reason for hiding this comment

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

This needs a test.

@@ -261,28 +261,27 @@ func encode(c Codec, msg interface{}, cp Compressor, cbuf *bytes.Buffer, outPayl
var (
b []byte
length uint
err error
Copy link
Contributor

Choose a reason for hiding this comment

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

all the changes in this file are unnecessary (and the new code is worse, since it increases the scope of err needlessly).

// the optimal option.
grpclog.Fatalf("grpc: Server failed to encode response %v", err)
err = fmt.Errorf("grpc: Server failed to encode response %v", err)
grpclog.Println(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

can this just return the error directly instead of also logging it?

// faulty stream locally and remotely (Other streams can keep going). Find
// the optimal option.
grpclog.Fatalf("grpc: Server failed to encode response %v", err)
err = fmt.Errorf("grpc: Server failed to encode response %v", err)
Copy link
Member

Choose a reason for hiding this comment

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

encode() should return a status error instead, and then we can just return it.

@menghanl
Copy link
Contributor Author

Replaced by #1251

@menghanl menghanl closed this May 19, 2017
@menghanl menghanl deleted the marshal_nil_error branch May 19, 2017 22:45
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server nil returns cause problems
3 participants