mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 07:45:51 +01:00
introduced new exception classes for structured error reporting
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
const similarityService = require('../../becca/similarity');
|
||||
const becca = require("../../becca/becca");
|
||||
const NotFoundError = require("../../errors/not_found_error.js");
|
||||
|
||||
async function getSimilarNotes(req) {
|
||||
const noteId = req.params.noteId;
|
||||
@@ -9,7 +10,7 @@ async function getSimilarNotes(req) {
|
||||
const note = becca.getNote(noteId);
|
||||
|
||||
if (!note) {
|
||||
return [404, `Note ${noteId} not found.`];
|
||||
throw new NotFoundError(`Note '${noteId}' not found.`);
|
||||
}
|
||||
|
||||
return await similarityService.findSimilarNotes(noteId);
|
||||
|
||||
Reference in New Issue
Block a user