Skip to content

Commit

Permalink
Update core to 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
avsej committed Jul 24, 2024
1 parent ea4baa4 commit 12caef7
Show file tree
Hide file tree
Showing 9 changed files with 624 additions and 475 deletions.
2 changes: 1 addition & 1 deletion src/deps/couchbase-cxx-client
29 changes: 29 additions & 0 deletions src/wrapper/common.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include "core_error_info.hxx"
#include "wrapper.hxx"

#include "common.hxx"
Expand Down Expand Up @@ -702,6 +703,34 @@ error_context_to_zval(const empty_error_context& /* ctx */,
/* nothing to do */
}

COUCHBASE_API
void
error_context_to_zval(const generic_error_context& ctx,
zval* return_value,
std::string& enhanced_error_message)
{
if (!ctx.message.empty()) {
if (!enhanced_error_message.empty()) {
enhanced_error_message.append(", ");
}
enhanced_error_message.append(ctx.message);
add_assoc_stringl(return_value, "message", ctx.message.data(), ctx.message.size());
}
if (!ctx.json_data.empty()) {
if (!enhanced_error_message.empty()) {
enhanced_error_message.append(", ");
}
enhanced_error_message.append(ctx.json_data);
add_assoc_stringl(return_value, "json", ctx.json_data.data(), ctx.json_data.size());
}
if (ctx.cause != nullptr) {
zval cause;
array_init(&cause);
error_context_to_zval(*ctx.cause, &cause, enhanced_error_message);
add_assoc_zval(return_value, "cause", &cause);
}
}

COUCHBASE_API
void
error_context_to_zval(const core_error_info& info,
Expand Down
Loading

0 comments on commit 12caef7

Please sign in to comment.