diff options
Diffstat (limited to 'python/google/protobuf/descriptor_database.py')
-rw-r--r-- | python/google/protobuf/descriptor_database.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/google/protobuf/descriptor_database.py b/python/google/protobuf/descriptor_database.py index a7616cbc..5453f50c 100644 --- a/python/google/protobuf/descriptor_database.py +++ b/python/google/protobuf/descriptor_database.py @@ -134,7 +134,11 @@ class DescriptorDatabase(object): # descriptor can also be found. The behavior is the same with # protobuf C++. top_level, _, _ = symbol.rpartition('.') - return self._file_desc_protos_by_symbol[top_level] + try: + return self._file_desc_protos_by_symbol[top_level] + except KeyError: + # Raise the original symbol as a KeyError for better diagnostics. + raise KeyError(symbol) def FindFileContainingExtension(self, extendee_name, extension_number): # TODO(jieluo): implement this API. |