From ac4ea25267be4c3a50d925cee025d6b008a65860 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 18 Apr 2019 00:09:08 +0900 Subject: [PATCH] Better error handling --- src/remote/activitypub/kernel/like.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/remote/activitypub/kernel/like.ts b/src/remote/activitypub/kernel/like.ts index a08b453a89..23b4aedd15 100644 --- a/src/remote/activitypub/kernel/like.ts +++ b/src/remote/activitypub/kernel/like.ts @@ -2,6 +2,7 @@ import { IRemoteUser } from '../../../models/entities/user'; import { ILike } from '../type'; import create from '../../../services/note/reaction/create'; import { Notes } from '../../../models'; +import { apLogger } from '../logger'; export default async (actor: IRemoteUser, activity: ILike) => { const id = typeof activity.object == 'string' ? activity.object : activity.object.id; @@ -14,7 +15,8 @@ export default async (actor: IRemoteUser, activity: ILike) => { const note = await Notes.findOne(noteId); if (note == null) { - throw new Error(); + apLogger.warn(`Like activity recivied, but no such note: ${id}`, { id }); + return; } await create(actor, note, activity._misskey_reaction);