From a0f6d763da13fca7341074a126ae513531f9aa5e Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Fri, 13 Aug 2021 12:25:15 +0200
Subject: [PATCH] ENH: Add status code for errors in higher order clients

---
 include/caosdb/status_code.h | 1 +
 src/caosdb/transaction.cpp   | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/caosdb/status_code.h b/include/caosdb/status_code.h
index 246a7c8..3a49d95 100644
--- a/include/caosdb/status_code.h
+++ b/include/caosdb/status_code.h
@@ -53,6 +53,7 @@ enum StatusCode {
   UNSUPPORTED_FEATURE = 27,
   ORIGINAL_ENTITY_MISSING_ID = 28,
   EXTERN_C_ASSIGNMENT_ERROR = 29,
+  OTHER_CLIENT_ERROR = 9999;
 };
 
 auto get_status_description(int code) -> const std::string &;
diff --git a/src/caosdb/transaction.cpp b/src/caosdb/transaction.cpp
index 0a7cedd..a7ddba8 100644
--- a/src/caosdb/transaction.cpp
+++ b/src/caosdb/transaction.cpp
@@ -83,7 +83,11 @@ auto get_status_description(int code) -> const std::string & {
      "This feature is not available in the this client implementation."},
     {StatusCode::EXTERN_C_ASSIGNMENT_ERROR,
      "You tried to assign a new object to the wrapped void pointer. You have "
-     "to delete the old pointee first."}};
+     "to delete the old pointee first."},
+    {StatusCode::OTHER_CLIENT_ERROR,
+     "This is code is reserved to errors raised by other clients wrapping the "
+     "C++ client (or its Extern C interface).  This should never occur when "
+     "working with the C++ code itself."}};
   try {
     return descriptions.at(code);
   } catch (const std::out_of_range &exc) {
-- 
GitLab