mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 03:47:40 -07:00
Better error handling
This commit is contained in:
parent
54c61ae4fa
commit
b47057a56f
1 changed files with 3 additions and 1 deletions
|
@ -2,6 +2,7 @@ import { IRemoteUser } from '../../../models/entities/user';
|
||||||
import { ILike } from '../type';
|
import { ILike } from '../type';
|
||||||
import create from '../../../services/note/reaction/create';
|
import create from '../../../services/note/reaction/create';
|
||||||
import { Notes } from '../../../models';
|
import { Notes } from '../../../models';
|
||||||
|
import { apLogger } from '../logger';
|
||||||
|
|
||||||
export default async (actor: IRemoteUser, activity: ILike) => {
|
export default async (actor: IRemoteUser, activity: ILike) => {
|
||||||
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
|
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);
|
const note = await Notes.findOne(noteId);
|
||||||
if (note == null) {
|
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);
|
await create(actor, note, activity._misskey_reaction);
|
||||||
|
|
Loading…
Reference in a new issue