mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
Better input framework error messages for unset non-optionals
The input framework currently gives a rather opaque error message when encountering a line in which a required value is not provided. This change updates this behavior; the error message now provides the record element (or the name or the index element) which was not set in the input data, even though it is required to be set by the underlying Zeek type.
This commit is contained in:
parent
0e40f7e6af
commit
33d6e1a011
6 changed files with 100 additions and 8 deletions
|
@ -1104,9 +1104,10 @@ Val* Manager::ValueToIndexVal(const Stream* i, int num_fields, const RecordType*
|
|||
|
||||
const char* warning = "Skipping input with missing non-optional value";
|
||||
if ( source && file_pos != -1 )
|
||||
Warning(i, "%s:%d: %s", source, file_pos, warning);
|
||||
Warning(i, "%s:%d: %s (index field %s)", source, file_pos, warning,
|
||||
type->FieldName(j));
|
||||
else
|
||||
Warning(i, "%s", warning);
|
||||
Warning(i, "%s (index field %s)", warning, type->FieldName(j));
|
||||
|
||||
have_error = true;
|
||||
}
|
||||
|
@ -1961,9 +1962,10 @@ RecordVal* Manager::ValueToRecordVal(const Stream* stream, const Value* const* v
|
|||
|
||||
const char* warning = "Skipping input with missing non-optional value";
|
||||
if ( source && file_pos != -1 )
|
||||
Warning(stream, "%s:%d: %s", source, file_pos, warning);
|
||||
Warning(stream, "%s:%d: %s (record field %s)", source, file_pos, warning,
|
||||
request_type->FieldName(i));
|
||||
else
|
||||
Warning(stream, "%s", warning);
|
||||
Warning(stream, "%s (record field %s)", warning, request_type->FieldName(i));
|
||||
|
||||
have_error = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue