diff --git a/src/remote/activitypub/kernel/accept/index.ts b/src/remote/activitypub/kernel/accept/index.ts index 5a27ce1d4d..083e312a6f 100644 --- a/src/remote/activitypub/kernel/accept/index.ts +++ b/src/remote/activitypub/kernel/accept/index.ts @@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: IAccept): Promise => { const resolver = new Resolver(); - let object; - - try { - object = await resolver.resolve(activity.object); - } catch (e) { + const object = await resolver.resolve(activity.object).catch(e => { logger.error(`Resolution failed: ${e}`); throw e; - } + }); switch (object.type) { case 'Follow': diff --git a/src/remote/activitypub/kernel/announce/index.ts b/src/remote/activitypub/kernel/announce/index.ts index a9447840b7..dfccde3f9d 100644 --- a/src/remote/activitypub/kernel/announce/index.ts +++ b/src/remote/activitypub/kernel/announce/index.ts @@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: IAnnounce): Promise => const resolver = new Resolver(); - let object; - - try { - object = await resolver.resolve(activity.object); - } catch (e) { + const object = await resolver.resolve(activity.object).catch(e => { logger.error(`Resolution failed: ${e}`); throw e; - } + }); if (validPost.includes(object.type)) { announceNote(resolver, actor, activity, object); diff --git a/src/remote/activitypub/kernel/create/index.ts b/src/remote/activitypub/kernel/create/index.ts index a6fa2336f3..395139bb75 100644 --- a/src/remote/activitypub/kernel/create/index.ts +++ b/src/remote/activitypub/kernel/create/index.ts @@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: ICreate): Promise => { const resolver = new Resolver(); - let object; - - try { - object = await resolver.resolve(activity.object); - } catch (e) { + const object = await resolver.resolve(activity.object).catch(e => { logger.error(`Resolution failed: ${e}`); throw e; - } + }); if (validPost.includes(object.type)) { createNote(resolver, actor, object); diff --git a/src/remote/activitypub/kernel/reject/index.ts b/src/remote/activitypub/kernel/reject/index.ts index 8ece5cf174..96e9aadf5d 100644 --- a/src/remote/activitypub/kernel/reject/index.ts +++ b/src/remote/activitypub/kernel/reject/index.ts @@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: IReject): Promise => { const resolver = new Resolver(); - let object; - - try { - object = await resolver.resolve(activity.object); - } catch (e) { + const object = await resolver.resolve(activity.object).catch(e => { logger.error(`Resolution failed: ${e}`); throw e; - } + }); switch (object.type) { case 'Follow': diff --git a/src/remote/activitypub/kernel/undo/index.ts b/src/remote/activitypub/kernel/undo/index.ts index f49f66cc69..4b23533058 100644 --- a/src/remote/activitypub/kernel/undo/index.ts +++ b/src/remote/activitypub/kernel/undo/index.ts @@ -20,14 +20,10 @@ export default async (actor: IRemoteUser, activity: IUndo): Promise => { const resolver = new Resolver(); - let object; - - try { - object = await resolver.resolve(activity.object); - } catch (e) { + const object = await resolver.resolve(activity.object).catch(e => { logger.error(`Resolution failed: ${e}`); throw e; - } + }); switch (object.type) { case 'Follow':