mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 21:18:20 +00:00
Change threading formatter errors to warnings.
This change standardizes threading formatter error handling and moves the remaining error calls to be warnings instead. This is in line with already existing code - in most cases warnings were raised, only a few cases raised errors. These cases do not differ significantly from other cases in which warnings are raised. This also fixes GH-692, in which misformatted lines prevent future file parsing. This commit also moves the FailWarn method that is used by both the config and the ascii reader up to the ReaderBackend. Furthermore it makes the Warning method of ReaderBackend respect the warning suppression that is introduced by the FailWarn method.
This commit is contained in:
parent
5171f25e3a
commit
deaab42187
12 changed files with 90 additions and 70 deletions
|
@ -50,7 +50,6 @@ Ascii::Ascii(ReaderFrontend *frontend) : ReaderBackend(frontend)
|
|||
{
|
||||
mtime = 0;
|
||||
ino = 0;
|
||||
suppress_warnings = false;
|
||||
fail_on_file_problem = false;
|
||||
fail_on_invalid_lines = false;
|
||||
}
|
||||
|
@ -65,7 +64,7 @@ void Ascii::DoClose()
|
|||
|
||||
bool Ascii::DoInit(const ReaderInfo& info, int num_fields, const Field* const* fields)
|
||||
{
|
||||
suppress_warnings = false;
|
||||
StopWarningSuppression();
|
||||
|
||||
separator.assign( (const char*) BifConst::InputAscii::separator->Bytes(),
|
||||
BifConst::InputAscii::separator->Len());
|
||||
|
@ -119,21 +118,6 @@ bool Ascii::DoInit(const ReaderInfo& info, int num_fields, const Field* const* f
|
|||
return DoUpdate();
|
||||
}
|
||||
|
||||
void Ascii::FailWarn(bool is_error, const char *msg, bool suppress_future)
|
||||
{
|
||||
if ( is_error )
|
||||
Error(msg);
|
||||
else
|
||||
{
|
||||
// suppress error message when we are already in error mode.
|
||||
// There is no reason to repeat it every second.
|
||||
if ( ! suppress_warnings )
|
||||
Warning(msg);
|
||||
|
||||
if ( suppress_future )
|
||||
suppress_warnings = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Ascii::OpenFile()
|
||||
{
|
||||
|
@ -173,7 +157,7 @@ bool Ascii::OpenFile()
|
|||
return ! fail_on_file_problem;
|
||||
}
|
||||
|
||||
suppress_warnings = false;
|
||||
StopWarningSuppression();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -309,7 +293,7 @@ bool Ascii::DoUpdate()
|
|||
// is to suppress an extra warning that we'd otherwise get on the initial
|
||||
// inode assignment.
|
||||
if ( ino != 0 )
|
||||
suppress_warnings = false;
|
||||
StopWarningSuppression();
|
||||
|
||||
mtime = sb.st_mtime;
|
||||
ino = sb.st_ino;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue