Merge pull request #6039 from Icinga/feature/improve-error-message

Improve location info for some error messages
This commit is contained in:
Jean Flach 2018-01-29 13:12:35 +01:00 committed by GitHub
commit 9c9d190b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -388,7 +388,7 @@ object:
bool defaultTmpl = $6; bool defaultTmpl = $6;
if (!abstract && defaultTmpl) if (!abstract && defaultTmpl)
BOOST_THROW_EXCEPTION(ScriptError("'default' keyword is invalid for object definitions", DebugInfoRange(@2, @4))); BOOST_THROW_EXCEPTION(ScriptError("'default' keyword is invalid for object definitions", @6));
bool seen_assign = context->m_SeenAssign.top(); bool seen_assign = context->m_SeenAssign.top();
context->m_SeenAssign.pop(); context->m_SeenAssign.pop();
@ -1158,7 +1158,7 @@ apply:
delete $6; delete $6;
if (!ApplyRule::IsValidSourceType(type)) if (!ApplyRule::IsValidSourceType(type))
BOOST_THROW_EXCEPTION(ScriptError("'apply' cannot be used with type '" + type + "'", DebugInfoRange(@2, @3))); BOOST_THROW_EXCEPTION(ScriptError("'apply' cannot be used with type '" + type + "'", @3));
if (!ApplyRule::IsValidTargetType(type, target)) { if (!ApplyRule::IsValidTargetType(type, target)) {
if (target == "") { if (target == "") {
@ -1178,7 +1178,7 @@ apply:
BOOST_THROW_EXCEPTION(ScriptError("'apply' target type is ambiguous (can be one of " + typeNames + "): use 'to' to specify a type", DebugInfoRange(@2, @3))); BOOST_THROW_EXCEPTION(ScriptError("'apply' target type is ambiguous (can be one of " + typeNames + "): use 'to' to specify a type", DebugInfoRange(@2, @3)));
} else } else
BOOST_THROW_EXCEPTION(ScriptError("'apply' target type '" + target + "' is invalid", DebugInfoRange(@2, @5))); BOOST_THROW_EXCEPTION(ScriptError("'apply' target type '" + target + "' is invalid", @6));
} }
bool seen_assign = context->m_SeenAssign.top(); bool seen_assign = context->m_SeenAssign.top();