From e810278be5378a3a6e40a9363f31b7b7dba6f18e Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Thu, 12 Aug 2021 11:23:29 +0200 Subject: [PATCH] ENH: Add status code for wrong void pointer assignment --- include/caosdb/status_code.h | 1 + src/caosdb/transaction.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/caosdb/status_code.h b/include/caosdb/status_code.h index a6fcda9..246a7c8 100644 --- a/include/caosdb/status_code.h +++ b/include/caosdb/status_code.h @@ -52,6 +52,7 @@ enum StatusCode { TRANSACTION_TYPE_ERROR = 26, UNSUPPORTED_FEATURE = 27, ORIGINAL_ENTITY_MISSING_ID = 28, + EXTERN_C_ASSIGNMENT_ERROR = 29, }; auto get_status_description(int code) -> const std::string &; diff --git a/src/caosdb/transaction.cpp b/src/caosdb/transaction.cpp index 61f5278..252b506 100644 --- a/src/caosdb/transaction.cpp +++ b/src/caosdb/transaction.cpp @@ -80,7 +80,10 @@ auto get_status_description(int code) -> const std::string & { "an id. This is the case when you did not retrieve it before applying any " "changes and instantiated the Entity class explicitely."}, {StatusCode::UNSUPPORTED_FEATURE, - "This feature is not available in the this client implementation."}}; + "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."}}; try { return descriptions.at(code); } catch (const std::out_of_range &exc) { -- GitLab