mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 14:35:29 +00:00
[2428] Test and fix error handling in $INCLUDE
This commit is contained in:
@@ -81,9 +81,7 @@ public:
|
|||||||
std::string error;
|
std::string error;
|
||||||
if (!lexer_.pushSource(filename.c_str(), &error)) {
|
if (!lexer_.pushSource(filename.c_str(), &error)) {
|
||||||
if (initialized_) {
|
if (initialized_) {
|
||||||
// $INCLUDE file
|
isc_throw(InternalException, error.c_str());
|
||||||
reportError(lexer_.getSourceName(), lexer_.getSourceLine(),
|
|
||||||
error);
|
|
||||||
} else {
|
} else {
|
||||||
// Top-level file
|
// Top-level file
|
||||||
reportError("", 0, error);
|
reportError("", 0, error);
|
||||||
@@ -116,7 +114,7 @@ public:
|
|||||||
void doInclude() {
|
void doInclude() {
|
||||||
// First, get the filename to include
|
// First, get the filename to include
|
||||||
const MasterToken::StringRegion
|
const MasterToken::StringRegion
|
||||||
filename(lexer_.getNextToken(MasterLexer::QSTRING).
|
filename(lexer_.getNextToken(MasterToken::QSTRING).
|
||||||
getStringRegion());
|
getStringRegion());
|
||||||
|
|
||||||
// TODO: Handle the case where there's Name after the
|
// TODO: Handle the case where there's Name after the
|
||||||
|
@@ -282,6 +282,10 @@ struct ErrorCase {
|
|||||||
// Check the unknown directive. The rest looks like ordinary RR,
|
// Check the unknown directive. The rest looks like ordinary RR,
|
||||||
// so we see the $ is actually special.
|
// so we see the $ is actually special.
|
||||||
{ "$UNKNOWN 3600 IN A 192.0.2.1", "Unknown $ directive" },
|
{ "$UNKNOWN 3600 IN A 192.0.2.1", "Unknown $ directive" },
|
||||||
|
{ "$INCLUDE", "Missing include path" },
|
||||||
|
{ "$INCLUDE /file/not/found", "Include file not found" },
|
||||||
|
{ "$INCLUDE /file/not/found and here goes bunch of garbage",
|
||||||
|
"Include file not found and garbage at the end of line" },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user