Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid error message in CRDTTreePos #178

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Sources/Document/CRDT/CRDTTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ extension CRDTTreePos {
let parentNode = tree.findFloorNode(parentID)
let leftNode = tree.findFloorNode(leftSiblingID)
guard let parentNode, var leftNode else {
throw YorkieError.unexpected(message: "cannot find node at \(self)")
throw YorkieError.unexpected(message: "cannot find node of CRDTTreePos(\(parentID.toTestString), \(leftSiblingID.toTestString))")
}

/**
Expand Down Expand Up @@ -173,6 +173,14 @@ struct CRDTTreeNodeID: Equatable, Comparable {
"\(self.createdAt.toIDString):\(self.offset)"
}

/**
* `toTestString` returns a string containing the meta data of the ticket
* for debugging purpose.
*/
var toTestString: String {
"\(self.createdAt.toTestString)/\(self.offset)"
}

static func < (lhs: CRDTTreeNodeID, rhs: CRDTTreeNodeID) -> Bool {
if lhs.createdAt == rhs.createdAt {
return lhs.offset < rhs.offset
Expand Down