From a092c393a633200992fa88bbac5da06802d35e15 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 5 Mar 2022 11:38:20 -0600 Subject: [PATCH] [ox/claw] Improve Claw read error reporting --- deps/ox/src/ox/claw/read.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deps/ox/src/ox/claw/read.cpp b/deps/ox/src/ox/claw/read.cpp index 2abfaa6d..13d9768c 100644 --- a/deps/ox/src/ox/claw/read.cpp +++ b/deps/ox/src/ox/claw/read.cpp @@ -15,7 +15,7 @@ namespace ox { Result readClawHeader(const char *buff, std::size_t buffLen) noexcept { const auto s1End = ox_strchr(buff, ';', buffLen); if (!s1End) { - return OxError(1); + return OxError(1, "Could not read Claw header"); } const auto s1Size = s1End - buff; String fmt(buff, s1Size); @@ -24,7 +24,7 @@ Result readClawHeader(const char *buff, std::size_t buffLen) noexcep const auto s2End = ox_strchr(buff, ';', buffLen); if (!s2End) { - return OxError(1); + return OxError(2, "Could not read Claw header"); } const auto s2Size = s2End - buff; String typeName(buff, s2Size); @@ -33,7 +33,7 @@ Result readClawHeader(const char *buff, std::size_t buffLen) noexcep const auto s3End = ox_strchr(buff, ';', buffLen); if (!s3End) { - return OxError(1); + return OxError(3, "Could not read Claw header"); } const auto s3Size = s3End - buff; String versionStr(buff, s3Size); @@ -46,7 +46,7 @@ Result readClawHeader(const char *buff, std::size_t buffLen) noexcep } else if (fmt == "O1") { hdr.fmt = ClawFormat::Organic; } else { - return OxError(1); + return OxError(4, "Claw format does not match any supported format/version combo"); } hdr.typeName = typeName; if (auto r = ox_atoi(versionStr.c_str()); r.error == 0) {