From 83647c7f016fb5196e5d69e3cf3ced948b3aacaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Wed, 18 Dec 2024 09:18:23 +0100 Subject: [PATCH] Improve deserialization error messages --- src/NZSL/Archive.cpp | 2 +- src/NZSL/Ast/AstSerializer.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/NZSL/Archive.cpp b/src/NZSL/Archive.cpp index d823918..5d2ae28 100644 --- a/src/NZSL/Archive.cpp +++ b/src/NZSL/Archive.cpp @@ -122,7 +122,7 @@ namespace nzsl std::uint32_t version; deserializer.Deserialize(version); if (version > s_shaderArchiveCurrentVersion) - throw std::runtime_error("unsupported version"); + throw std::runtime_error(fmt::format("unsupported archive version {0} (max supported version: {1})", version, s_shaderArchiveCurrentVersion)); std::uint32_t moduleCount; deserializer.Deserialize(moduleCount); diff --git a/src/NZSL/Ast/AstSerializer.cpp b/src/NZSL/Ast/AstSerializer.cpp index 22e11fc..08eed86 100644 --- a/src/NZSL/Ast/AstSerializer.cpp +++ b/src/NZSL/Ast/AstSerializer.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace nzsl::Ast { @@ -861,7 +862,7 @@ namespace nzsl::Ast m_deserializer.Deserialize(m_version); if (m_version > s_shaderAstCurrentVersion) - throw std::runtime_error("unsupported version"); + throw std::runtime_error(fmt::format("unsupported module version {0} (max supported version: {1})", m_version, s_shaderAstCurrentVersion)); ModulePtr module = std::make_shared(); SerializeModule(*module);