Skip to content

Commit

Permalink
Improve deserialization error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
SirLynix committed Dec 18, 2024
1 parent 6f6acf5 commit 83647c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/NZSL/Archive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/NZSL/Ast/AstSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <NZSL/ShaderBuilder.hpp>
#include <NZSL/Ast/ExpressionVisitor.hpp>
#include <NZSL/Ast/StatementVisitor.hpp>
#include <fmt/format.h>

namespace nzsl::Ast
{
Expand Down Expand Up @@ -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<Module>();
SerializeModule(*module);
Expand Down

0 comments on commit 83647c7

Please sign in to comment.