remove duplicate error checking blocks from ApInboxService.ts

This commit is contained in:
Hazelnoot 2025-03-03 00:52:54 -05:00
parent f2033ecdc6
commit 41dfe7e329

View file

@ -357,22 +357,10 @@ export class ApInboxService {
} }
// Announce対象をresolve // Announce対象をresolve
let renote; // The target ID is verified by secureResolve, so we know it shares host authority with the actor who sent it.
try { // This means we can pass that ID to resolveNote and avoid an extra fetch, which will fail if the note is private.
// The target ID is verified by secureResolve, so we know it shares host authority with the actor who sent it. const renote = await this.apNoteService.resolveNote(target, { resolver, sentFrom: getApId(target) });
// This means we can pass that ID to resolveNote and avoid an extra fetch, which will fail if the note is private. if (renote == null) return 'announce target is null';
renote = await this.apNoteService.resolveNote(target, { resolver, sentFrom: getApId(target) });
if (renote == null) return 'announce target is null';
} catch (err) {
// 対象が4xxならスキップ
if (err instanceof StatusError) {
if (!err.isRetryable) {
return `skip: ignored announce target ${target.id} - ${err.statusCode}`;
}
return `Error in announce target ${target.id} - ${err.statusCode}`;
}
throw err;
}
if (!await this.noteEntityService.isVisibleForMe(renote, actor.id)) { if (!await this.noteEntityService.isVisibleForMe(renote, actor.id)) {
return 'skip: invalid actor for this activity'; return 'skip: invalid actor for this activity';
@ -548,12 +536,6 @@ export class ApInboxService {
await this.apNoteService.createNote(note, actor, resolver, silent); await this.apNoteService.createNote(note, actor, resolver, silent);
return 'ok'; return 'ok';
} catch (err) {
if (err instanceof StatusError && !err.isRetryable) {
return `skip: ${err.statusCode}`;
} else {
throw err;
}
} finally { } finally {
unlock(); unlock();
} }