Skip to content

Some collection APIs with nullable return value don't reset CBLError.code #499

@blaugold

Description

@blaugold

APIs which can return nullptr without it being an error need to set CBLError.code to 0 in this case. CBLCollection_GetDocument does this:

auto doc = collection->getDocument(docID).detach();
if (!doc && outError)
outError->code = 0;
return doc;

This is necessary because CBLError is often allocated on the stack once and then reused. If a previous call failed, CBLError.code contains the result code for the previous call.

CBLDatabase_Scope, CBLDatabase_Collection and CBLScope_Collection don't do this. I have not checked all APIs for this, so there might be more instances.

Metadata

Metadata

Assignees

Labels

👩‍⚕️ triagedThis issue has been verified and moved to JIRA

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions