This is an archive of the discontinued LLVM Phabricator instance.

All Errors must be checked
ClosedPublic

Authored by beanz on Sep 10 2019, 10:19 AM.

Details

Summary

If an error is ever returned from any of the functions called here, the error must be joined with the Result Error before being returned otherwise the Result Error will assert on destruction.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz created this revision.Sep 10 2019, 10:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2019, 10:19 AM

I think you need to consume Result here instead of joining it:

if (auto Err = SerializationTraits<ChannelT, Error, Error>::deserialize(C, Result)) {
  consumeError(std::move(Result));
  return std::move(Err);
}

In the first check deserialization has failed, so Result doesn't contain a meaningful Error value (it's probably still success, but it would depend on how the deserializer was written). In the second check you could return Result (since it has been fully deserialized) but for symmetry with other values I think you just want to consume it and return the RPC failure: that's what we do everywhere else.

beanz updated this revision to Diff 219636.Sep 10 2019, 5:06 PM

Updates based on feedback from Lang.

lhames accepted this revision.Sep 11 2019, 1:22 PM

LGTM. Thanks Chris!

This revision is now accepted and ready to land.Sep 11 2019, 1:22 PM
This revision was automatically updated to reflect the committed changes.