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:
Johanna Amann 2023-07-21 15:11:31 +01:00
parent 0e40f7e6af
commit 33d6e1a011
6 changed files with 100 additions and 8 deletions

View file

@ -1,9 +1,9 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
warning: ../input.log:3: Skipping input with missing non-optional value
warning: ../input.log:3: Skipping input with missing non-optional value (record field s)
warning: ..<...>/Input::READER_ASCII: ../input.log, line 4: Invalid value for subnet: 127.0.0.1
warning: ..<...>/Input::READER_ASCII: ../input.log, line 4: Error while reading set or vector
warning: ..<...>/Input::READER_ASCII: ../input.log, line 4: Could not convert line 'name 127.0.0.1' of ../input.log to Val. Ignoring line.
warning: ../input.log:3: Skipping input with missing non-optional value
warning: ../input.log:3: Skipping input with missing non-optional value (record field s)
warning: ..<...>/Input::READER_ASCII: ../input.log, line 4: Invalid value for subnet: 127.0.0.1
warning: ..<...>/Input::READER_ASCII: ../input.log, line 4: Error while reading set or vector
warning: ..<...>/Input::READER_ASCII: ../input.log, line 4: Could not convert line 'name 127.0.0.1' of ../input.log to Val. Ignoring line.

View file

@ -1,11 +1,11 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
### NOTE: This file has been sorted with diff-sort.
EventErrorEvent, ../input.log:3: Skipping input with missing non-optional value, Reporter::WARNING
EventErrorEvent, ../input.log:3: Skipping input with missing non-optional value (record field s), Reporter::WARNING
EventErrorEvent, Could not convert line 'name\x09127.0.0.1' of ../input.log to Val. Ignoring line., Reporter::WARNING
EventErrorEvent, Error while reading set or vector, Reporter::WARNING
EventErrorEvent, Invalid value for subnet: 127.0.0.1, Reporter::WARNING
TableErrorEvent, ../input.log:3: Skipping input with missing non-optional value, Reporter::WARNING
TableErrorEvent, ../input.log:3: Skipping input with missing non-optional value (record field s), Reporter::WARNING
TableErrorEvent, Could not convert line 'name\x09127.0.0.1' of ../input.log to Val. Ignoring line., Reporter::WARNING
TableErrorEvent, Error while reading set or vector, Reporter::WARNING
TableErrorEvent, Invalid value for subnet: 127.0.0.1, Reporter::WARNING