class ErrorCollector
Defined at line 2164 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
Constructs a DescriptorPool that, when it can't find something among the
descriptors already in the pool, looks for it in the given
DescriptorDatabase.
Notes:
- If a DescriptorPool is constructed this way, its BuildFile*() methods
must not be called (they will assert-fail). The only way to populate
the pool with descriptors is to call the Find*By*() methods.
- The Find*By*() methods may block the calling thread if the
DescriptorDatabase blocks. This in turn means that parsing messages
may block if they need to look up extensions.
- The Find*By*() methods will use mutexes for thread-safety, thus making
them slower even when they don't have to fall back to the database.
In fact, even the Find*By*() methods of descriptor objects owned by
this pool will be slower, since they will have to obtain locks too.
- An ErrorCollector may optionally be given to collect validation errors
in files loaded from the database. If not given, errors will be printed
to ABSL_LOG(ERROR). Remember that files are built on-demand, so this
ErrorCollector may be called from any thread that calls one of the
Find*By*() methods.
- The DescriptorDatabase must not be mutated during the lifetime of
the DescriptorPool. Even if the client takes care to avoid data races,
changes to the content of the DescriptorDatabase may not be reflected
in subsequent lookups in the DescriptorPool.
Public Methods
void ErrorCollector ()
Defined at line 2166 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
void ErrorCollector (const ErrorCollector & )
Defined at line 2168 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
ErrorCollector & operator= (const ErrorCollector & )
Defined at line 2169 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
void ~ErrorCollector ()
absl::string_view ErrorLocationName (ErrorLocation location)
void RecordError (absl::string_view filename, absl::string_view element_name, const Message * descriptor, ErrorLocation location, absl::string_view message)
Reports an error in the FileDescriptorProto. Use this function if the
problem occurred should interrupt building the FileDescriptorProto.
Provided the following arguments:
filename - File name in which the error occurred.
element_name - Full name of the erroneous element.
descriptor - Descriptor of the erroneous element.
location - One of the location constants, above.
message - Human-readable error message.
void RecordWarning (absl::string_view filename, absl::string_view element_name, const Message * descriptor, ErrorLocation location, absl::string_view message)
Reports a warning in the FileDescriptorProto. Use this function if the
problem occurred should NOT interrupt building the FileDescriptorProto.
Provided the following arguments:
filename - File name in which the error occurred.
element_name - Full name of the erroneous element.
descriptor - Descriptor of the erroneous element.
location - One of the location constants, above.
message - Human-readable error message.
Defined at line 2214 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h
Enumerations
enum ErrorLocation
| Name | Value |
|---|---|
| NAME | 0 |
| NUMBER | 1 |
| TYPE | 2 |
| EXTENDEE | 3 |
| DEFAULT_VALUE | 4 |
| INPUT_TYPE | 5 |
| OUTPUT_TYPE | 6 |
| OPTION_NAME | 7 |
| OPTION_VALUE | 8 |
| IMPORT | 9 |
| EDITIONS | 10 |
| OTHER | 11 |
These constants specify what exact part of the construct is broken.
This is useful e.g. for mapping the error back to an exact location
in a .proto file.
Defined at line 2176 of file ../../third_party/protobuf/src/google/protobuf/descriptor.h