fix setNoteToParent API method, closes #360

This commit is contained in:
azivner
2019-01-20 16:33:09 +01:00
parent 1f853024ee
commit 596544eca3
2 changed files with 3 additions and 3 deletions

View File

@@ -113,8 +113,8 @@ async function sortNotesAlphabetically(parentNoteId) {
async function setNoteToParent(noteId, prefix, parentNoteId) {
const parentNote = await repository.getNote(parentNoteId);
if (parentNote.isDeleted) {
throw new Error("Cannot move note to deleted parent note");
if (parentNote && parentNote.isDeleted) {
throw new Error(`Cannot move note to deleted parent note ${parentNoteId}`);
}
// case where there might be more such branches is ignored. It's expected there should be just one