1
0
Fork 0

fix(backend): Deal with json errors

This commit is contained in:
Joost De Cock 2023-08-18 12:45:27 +02:00
parent 292f4144d0
commit 6227a0f0ab

View file

@ -107,7 +107,11 @@ export function decorateModel(Model, tools, modelConfig) {
if (this.record) {
for (const field of this.jsonFields) {
if (this.encryptedFields && this.encryptedFields.includes(field)) {
this.clear[field] = JSON.parse(this.clear[field])
try {
this.clear[field] = JSON.parse(this.clear[field])
} catch (err) {
console.log(err, typeof this.clear[field])
}
} else {
this.record[field] = JSON.parse(this.record[field])
}