From d03ab159ccdb4f2ebc213dbf27d32bb6cf8d3911 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 22 Sep 2021 21:14:00 +1000 Subject: [PATCH] Improve error message when keyword not found. See #491. --- src/ifcopenshell-python/ifcopenshell/express/templates.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/express/templates.py b/src/ifcopenshell-python/ifcopenshell/express/templates.py index 1f15a6bc41d..0e65ada1002 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/templates.py +++ b/src/ifcopenshell-python/ifcopenshell/express/templates.py @@ -190,14 +190,14 @@ class IFC_PARSE_API %(name)s : %(superclass)s { } const char* %(schema_name)s::%(name)s::ToString(Value v) { - if ( v < 0 || v >= %(max_id)d ) throw IfcException("Unable to find find keyword in schema"); + if ( v < 0 || v >= %(max_id)d ) throw IfcException("Unable to find keyword in schema"); const char* names[] = { %(values)s }; return names[v]; } %(schema_name)s::%(name)s::Value %(schema_name)s::%(name)s::FromString(const std::string& s) { %(from_string_statements)s - throw IfcException("Unable to find find keyword in schema"); + throw IfcException("Unable to find keyword in schema: " + s); } %(schema_name)s::%(name)s::operator %(schema_name)s::%(name)s::Value() const { @@ -210,7 +210,7 @@ class IFC_PARSE_API %(name)s : %(superclass)s { %(inverse)s const IfcParse::entity& %(schema_name)s::%(name)s::declaration() const { return *%(schema_name_upper)s_%(name)s_type; } const IfcParse::entity& %(schema_name)s::%(name)s::Class() { return *%(schema_name_upper)s_%(name)s_type; } -%(schema_name)s::%(name)s::%(name)s(IfcEntityInstanceData* e) : %(superclass)s { if (!e) return; if (e->type() != %(schema_name_upper)s_%(name)s_type) throw IfcException("Unable to find find keyword in schema"); data_ = e; } +%(schema_name)s::%(name)s::%(name)s(IfcEntityInstanceData* e) : %(superclass)s { if (!e) return; if (e->type() != %(schema_name_upper)s_%(name)s_type) throw IfcException("Unable to find keyword in schema"); data_ = e; } %(schema_name)s::%(name)s::%(name)s(%(constructor_arguments)s) : %(superclass)s {data_ = new IfcEntityInstanceData(%(schema_name_upper)s_%(name)s_type); %(constructor_implementation)s } """