mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
method for reporting run-time errors in compiled-to-C++ scripts
This commit is contained in:
parent
cf79c05e3a
commit
00d66f1ac2
2 changed files with 19 additions and 0 deletions
|
@ -187,6 +187,21 @@ void Reporter::RuntimeError(const detail::Location* location, const char* fmt, .
|
||||||
throw InterpreterException();
|
throw InterpreterException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reporter::CPPRuntimeError(const char* fmt, ...)
|
||||||
|
{
|
||||||
|
++errors;
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, fmt);
|
||||||
|
FILE* out = EmitToStderr(errors_to_stderr) ? stderr : nullptr;
|
||||||
|
DoLog("runtime error in compiled code", reporter_error, out, nullptr, nullptr, true, true, "", fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
if ( abort_on_scripting_errors )
|
||||||
|
abort();
|
||||||
|
|
||||||
|
throw InterpreterException();
|
||||||
|
}
|
||||||
|
|
||||||
void Reporter::InternalError(const char* fmt, ...)
|
void Reporter::InternalError(const char* fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
|
@ -100,6 +100,10 @@ public:
|
||||||
// function will not return but raise an InterpreterException.
|
// function will not return but raise an InterpreterException.
|
||||||
[[noreturn]] void RuntimeError(const detail::Location* location, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
[[noreturn]] void RuntimeError(const detail::Location* location, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||||
|
|
||||||
|
// Report a runtime error in executing a compiled script. This
|
||||||
|
// function will not return but raise an InterpreterException.
|
||||||
|
[[noreturn]] void CPPRuntimeError(const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||||
|
|
||||||
// Report a traffic weirdness, i.e., an unexpected protocol situation
|
// Report a traffic weirdness, i.e., an unexpected protocol situation
|
||||||
// that may lead to incorrectly processing a connnection.
|
// that may lead to incorrectly processing a connnection.
|
||||||
void Weird(const char* name, const char* addl = "", const char* source = ""); // Raises net_weird().
|
void Weird(const char* name, const char* addl = "", const char* source = ""); // Raises net_weird().
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue