From 6fef0916b4855f1442d41fed34000f958e41dbdf Mon Sep 17 00:00:00 2001 From: asuessenbach Date: Wed, 5 May 2021 09:54:49 +0200 Subject: [PATCH] Add some detail for a specific suspect case of not supported creation functions. --- VulkanHppGenerator.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index a3e2944..cb43aca 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -6836,7 +6836,7 @@ std::pair VulkanHppGenerator::constructRAIIHandleConst [&handle]( ParamData const & pd ) { return pd.type.type == handle.first; } ); assert( handleParamIt != constructorIt->second.params.end() && handleParamIt->type.isNonConstPointer() ); - std::string singularConstructor, arrayConstructor; + std::string singularConstructor, arrayConstructor, throwDetail; bool constructedConstructor = false; if ( handleParamIt->len.empty() ) { @@ -6845,11 +6845,17 @@ std::pair VulkanHppGenerator::constructRAIIHandleConst singularConstructor = constructRAIIHandleConstructorVoid( handle, constructorIt, enter, leave ); constructedConstructor = true; } - else if ( ( constructorIt->second.returnType == "VkResult" ) && - ( constructorIt->second.successCodes.size() == 1 ) && ( !constructorIt->second.errorCodes.empty() ) ) + else if ( ( constructorIt->second.returnType == "VkResult" ) && ( constructorIt->second.successCodes.size() == 1 ) ) { - singularConstructor = constructRAIIHandleConstructorResult( handle, constructorIt, enter, leave ); - constructedConstructor = true; + if ( !constructorIt->second.errorCodes.empty() ) + { + singularConstructor = constructRAIIHandleConstructorResult( handle, constructorIt, enter, leave ); + constructedConstructor = true; + } + else + { + throwDetail = "\n\tReason: no errorcodes provided."; + } } } else @@ -6880,7 +6886,8 @@ std::pair VulkanHppGenerator::constructRAIIHandleConst } if ( !constructedConstructor ) { - throw std::runtime_error( "Never encountered a constructor function like " + constructorIt->first + " !" ); + throw std::runtime_error( "Never encountered a constructor function like " + constructorIt->first + " !" + + throwDetail ); } return std::make_pair( singularConstructor, arrayConstructor ); }