do not throw ProgrammingError in case of patch mismatch for File type

We do not throw a ProgrammingError when there is a patch mismatch for
type tutanota/File. Additionally, we are not storing instances with
errors to the offline storage and are throwing a ProgrammingError.
This commit is contained in:
abp 2025-07-24 12:28:16 +02:00
parent f556dc9ea5
commit fbceb21eb4
No known key found for this signature in database
GPG key ID: 791D4EC38A7AA7C2
3 changed files with 21 additions and 4 deletions

View file

@ -11,6 +11,7 @@ import { parseTypeString } from "@tutao/tutanota-utils/dist/TypeRef"
import { ServerTypeModelResolver } from "../../common/EntityFunctions"
import { expandId } from "./RestClientIdUtils"
import { Nullable } from "@tutao/tutanota-utils/dist/Utils"
import { hasError } from "../../common/utils/ErrorUtils"
/** Cache for a single list. */
type ListCache = {
@ -216,6 +217,11 @@ export class EphemeralCacheStorage implements CacheStorage {
const typeModel = await this.typeModelResolver.resolveServerTypeReference(typeRef)
const instanceId = AttributeModel.getAttribute<IdTuple | Id>(instanceClone, "_id", typeModel)
let { listId, elementId } = expandId(instanceId)
if (hasError(instance)) {
throw new ProgrammingError(
`Trying to put parsed instance with _errors to ephemeral cache. Type: ${typeModel.app}/${typeModel.name}, Id: ["${listId}", "${elementId}"]`,
)
}
elementId = ensureBase64Ext(typeModel, elementId)
const handler = this.customCacheHandlerMap.get(typeRef as TypeRef<SomeEntity>)