From: Gunnar Beutner Date: Thu, 19 Mar 2015 12:47:40 +0000 (+0100) Subject: Improve error message for invalid field access X-Git-Tag: v2.3.3~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ab36912ccdaae93f162d9a1891927399c7c8e242;p=icinga2 Improve error message for invalid field access fixes #8769 --- diff --git a/lib/config/vmops.hpp b/lib/config/vmops.hpp index 5bb3cf451..42f338d26 100644 --- a/lib/config/vmops.hpp +++ b/lib/config/vmops.hpp @@ -186,7 +186,8 @@ public: static inline Value GetPrototypeField(const Value& context, const String& field, bool not_found_error = true, const DebugInfo& debugInfo = DebugInfo()) { - Type::Ptr type = context.GetReflectionType(); + Type::Ptr ctype = context.GetReflectionType(); + Type::Ptr type = ctype; do { Object::Ptr object = type->GetPrototype(); @@ -198,7 +199,7 @@ public: } while (type); if (not_found_error) - BOOST_THROW_EXCEPTION(ScriptError("Invalid field name: '" + field + "'", debugInfo)); + BOOST_THROW_EXCEPTION(ScriptError("Invalid field access (for value of type '" + ctype->GetName() + "'): '" + field + "'", debugInfo)); else return Empty; }