error handling

This commit is contained in:
zadam 2021-02-22 21:59:37 +01:00
parent ddf8438b22
commit 208baa56e9
2 changed files with 13 additions and 1 deletions

View file

@ -193,6 +193,10 @@ function getNoteTypeClass(type) {
}
function getMimeTypeClass(mime) {
if (!mime) {
return "";
}
const semicolonIdx = mime.indexOf(';');
if (semicolonIdx !== -1) {

View file

@ -238,7 +238,15 @@ async function findSimilarNotes(noteId) {
return [];
}
const dateLimits = buildDateLimits(baseNote);
let dateLimits;
try {
dateLimits = buildDateLimits(baseNote);
}
catch (e) {
throw new Error(`Date limits failed with ${e.message}, entity: ${JSON.stringify(baseNote.pojo)}`);
}
const rewardMap = buildRewardMap(baseNote);
let ancestorRewardCache = {};
const ancestorNoteIds = new Set(baseNote.ancestors.map(note => note.noteId));