mirror of
https://github.com/tutao/tutanota.git
synced 2025-12-08 06:09:50 +00:00
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:
parent
f556dc9ea5
commit
fbceb21eb4
3 changed files with 21 additions and 4 deletions
|
|
@ -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>)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue