ChangeApplyError

class ChangeApplyError(val docKey: String? = null, val changeID: String, val opIndex: Int? = null, val operation: String? = null, cause: Throwable?) : YorkieException

ChangeApplyError is thrown when a change cannot be applied to a document (JS error.ts ChangeApplyError, 4251ab7e, #1403).

It names the document, the change and the operation that failed, and keeps the original error reachable as Throwable.cause (via initCause, the standard JVM cause chain — JS re-declares cause as its own field since it has no such chain). Without it the only signal is whatever the operation threw, which says nothing about which change is stuck — and because the checkpoint does not advance past a change that throws, the server keeps redelivering it.

operation names the operation by its type and the target element's ticket ONLY — it MUST NOT carry the operation's payload (plaintext document content). This means errorMessage (and so Throwable.message/toString) never carries the operation's payload either — but it DOES splice in the original cause's own message (cause.message ?: cause.toString(), changeApplyErrorMessage), which can carry arbitrary content a lower layer put there (e.g. a collection's "requested value: ..." text). Document.applyChangePack's stuck-checkpoint log line is therefore metadata-only on purpose: it logs the failing exception's class name, not this message — callers that log or surface a caught ChangeApplyError's own message should be aware it is not payload-free the way operation alone is.

Constructors

Link copied to clipboard
constructor(docKey: String? = null, changeID: String, opIndex: Int? = null, operation: String? = null, cause: Throwable?)

Properties

Link copied to clipboard
open val cause: Throwable?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val docKey: String? = null
Link copied to clipboard
Link copied to clipboard
open val message: String?
Link copied to clipboard
val operation: String? = null
Link copied to clipboard
val opIndex: Int? = null

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
operator fun component2(): String
Link copied to clipboard
fun copy(code: YorkieException.Code = this.code, errorMessage: String = this.errorMessage): YorkieException

Returns a plain YorkieException with the given code and errorMessage, each defaulting to this instance's own value. Unlike a data class's generated copy, this always constructs the base YorkieException type, even when called on a subclass such as ChangeApplyError (documented divergence, see the class KDoc above).

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override fun toString(): String

Reproduces the data-class text YorkieException(code=…, errorMessage=…) for a plain YorkieException — a hard-coded literal, NOT javaClass.simpleName, so the base class's own name stays byte-identical to the pre-open-class data-class output even under R8 minification in a consumer app with no keep rule for it (a review finding on the change apply error: javaClass.simpleName alone is not R8-stable). A subclass — e.g. ChangeApplyError(code=…, errorMessage=…) — still uses Any.javaClass/Class.getSimpleName, so its OWN name can be obfuscated by R8 in a consumer app without a keep rule for that subclass; a consumer-rules follow-up (e.g. a -keep entry, or extending the literal approach to subclasses) is intentionally not added here, out of this fix's scope.

Link copied to clipboard

Returns this error named with the given docKey. The change knows which operation failed but not which document it belongs to, so the document adds its key as the error passes through (Document.applyChanges's outer catch).