Tolerance: fromProtobuf() methods should throw a checked exception
iainmcgin opened this issue · 1 comments
iainmcgin commented
The validating wrapper types we have defined in protocol should all following a general pattern:
-
A Builder constructor should exist, which takes a protocol buffer. This should throw unchecked exceptions if the protocol buffer is semantically invalid.
-
A
fromProtobuf
method (and utility variants) should throw checked exceptions if the protocol buffer is semantically invalid.
This will allow code paths that are accepting potentially invalid data to use fromProtobuf
and catch the exception for invalid data, and recover appropriately.