mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Refusing to cache an object which can't be parsed
This commit is contained in:
@@ -117,10 +117,12 @@ export abstract class BaseResponseParsingService {
|
|||||||
const serializer = new this.serializerConstructor(objConstructor);
|
const serializer = new this.serializerConstructor(objConstructor);
|
||||||
return serializer.deserialize(obj);
|
return serializer.deserialize(obj);
|
||||||
} else {
|
} else {
|
||||||
|
console.warn('cannot deserialize type ' + type);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
console.warn('cannot deserialize type ' + type);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,7 +144,8 @@ export abstract class BaseResponseParsingService {
|
|||||||
} else {
|
} else {
|
||||||
dataJSON = JSON.stringify(data);
|
dataJSON = JSON.stringify(data);
|
||||||
}
|
}
|
||||||
throw new Error(`Can't cache incomplete ${type}: ${JSON.stringify(co)}, parsed from (partial) response: ${dataJSON}`);
|
console.warn(`Can't cache incomplete ${type}: ${JSON.stringify(co)}, parsed from (partial) response: ${dataJSON}`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.objectCache.add(co, hasValue(request.responseMsToLive) ? request.responseMsToLive : this.EnvConfig.cache.msToLive.default, request.uuid);
|
this.objectCache.add(co, hasValue(request.responseMsToLive) ? request.responseMsToLive : this.EnvConfig.cache.msToLive.default, request.uuid);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user