Skip to content
Snippets Groups Projects
Commit 72dfcb1f authored by Daniel Hornung's avatar Daniel Hornung
Browse files

FIX: Error when retrieving nonexisting entities.

parent a9f7a6fd
No related branches found
No related tags found
1 merge request!3Full functionality of libcaosdb
Pipeline #12517 passed with warnings
Pipeline: caosdb-octaveinttest

#12520

    ...@@ -52,13 +52,14 @@ auto mxFromCaosDBMessages(const ce::Messages &messages) -> mxArray *; ...@@ -52,13 +52,14 @@ auto mxFromCaosDBMessages(const ce::Messages &messages) -> mxArray *;
    */ */
    auto transactionStatusToMessage(const caosdb::transaction::Transaction *const trans) auto transactionStatusToMessage(const caosdb::transaction::Transaction *const trans)
    -> std::pair<string, string> { -> std::pair<string, string> {
    auto status = trans->GetStatus(); const auto &status = trans->GetStatus();
    auto code = status.GetCode(); const auto &code = status.GetCode();
    // Don't raise errors if it's only transaction errors (put into entity messages). // Don't raise errors if it's only transaction errors (put into entity
    if (!status.IsError() || code == caosdb::StatusCode::GENERIC_TRANSACTION_ERROR) { // messages).
    if (!status.IsError()) { // || code == caosdb::StatusCode::GENERIC_TRANSACTION_ERROR) {
    return std::pair<string, string>(); return std::pair<string, string>();
    } }
    string id = std::to_string(code); string id = string("maoxdb:") + std::to_string(code);
    string text = status.GetDescription(); string text = status.GetDescription();
    return std::pair<string, string>(id, text); return std::pair<string, string>(id, text);
    } }
    ......
    ...@@ -91,7 +91,7 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[]) ...@@ -91,7 +91,7 @@ void mexFunction(int /*nlhs*/, mxArray *plhs[], int nrhs, const mxArray *prhs[])
    transaction->RetrieveById(id); transaction->RetrieveById(id);
    } }
    transaction->ExecuteAsynchronously(); transaction->ExecuteAsynchronously();
    auto t_stat = transaction->WaitForIt(); const auto &t_stat = transaction->WaitForIt();
    maoxdb::throwOctExceptionIfError(transaction.get()); maoxdb::throwOctExceptionIfError(transaction.get());
    // Status must be OK or GENERIC_TRANSACTION_ERROR now. // Status must be OK or GENERIC_TRANSACTION_ERROR now.
    const auto &results = transaction->GetResultSet(); const auto &results = transaction->GetResultSet();
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment