From 6c664697a94d50ab41ebeabf7742143c3f49b7ab Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sat, 26 Apr 2025 18:29:13 +0100 Subject: [PATCH] Fix parsing of exception messages in C++ --- cxx/src/api/exception.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cxx/src/api/exception.cpp b/cxx/src/api/exception.cpp index 775ea61b..1292271f 100644 --- a/cxx/src/api/exception.cpp +++ b/cxx/src/api/exception.cpp @@ -143,7 +143,7 @@ std::exception_ptr mapError(const ::rust::Error& error) { UndefinedGroupError(getErrorSuffix(error.what()))); } else if (startsWith(error.what(), ESPLUGIN_ERROR_PREFIX)) { const auto [code, details] = parseSystemError( - std::string_view(error.what()).substr(0, ESPLUGIN_ERROR_PREFIX.size())); + std::string_view(error.what()).substr(ESPLUGIN_ERROR_PREFIX.size())); return std::make_exception_ptr( std::system_error(code, esplugin_category(), details)); @@ -151,13 +151,13 @@ std::exception_ptr mapError(const ::rust::Error& error) { } else if (startsWith(error.what(), LIBLOADORDER_ERROR_PREFIX)) { const auto [code, details] = parseSystemError(std::string_view(error.what()) - .substr(0, LIBLOADORDER_ERROR_PREFIX.size())); + .substr(LIBLOADORDER_ERROR_PREFIX.size())); return std::make_exception_ptr( std::system_error(code, libloadorder_category(), details)); } else if (startsWith(error.what(), LCI_ERROR_PREFIX)) { const auto [code, details] = parseSystemError( - std::string_view(error.what()).substr(0, LCI_ERROR_PREFIX.size())); + std::string_view(error.what()).substr(LCI_ERROR_PREFIX.size())); return std::make_exception_ptr(ConditionSyntaxError( code, loot_condition_interpreter_category(), details));