mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 12:36:57 +00:00
remove duplicate error checking blocks from ApInboxService.ts
This commit is contained in:
parent
f2033ecdc6
commit
41dfe7e329
1 changed files with 4 additions and 22 deletions
|
@ -357,22 +357,10 @@ export class ApInboxService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Announce対象をresolve
|
// Announce対象をresolve
|
||||||
let renote;
|
|
||||||
try {
|
|
||||||
// The target ID is verified by secureResolve, so we know it shares host authority with the actor who sent it.
|
// The target ID is verified by secureResolve, so we know it shares host authority with the actor who sent it.
|
||||||
// This means we can pass that ID to resolveNote and avoid an extra fetch, which will fail if the note is private.
|
// This means we can pass that ID to resolveNote and avoid an extra fetch, which will fail if the note is private.
|
||||||
renote = await this.apNoteService.resolveNote(target, { resolver, sentFrom: getApId(target) });
|
const renote = await this.apNoteService.resolveNote(target, { resolver, sentFrom: getApId(target) });
|
||||||
if (renote == null) return 'announce target is null';
|
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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue