リプライ先をエラー時に無視すると本来は投票なのに投票じゃないと扱われおかしくなるのでエラーにするように

This commit is contained in:
syuilo 2019-04-13 18:45:07 +09:00
parent 53d46d1cbe
commit 8cb9852058
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
1 changed files with 8 additions and 6 deletions

View File

@ -120,13 +120,15 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
: [];
// リプライ
const reply: Note | undefined | null = note.inReplyTo
? await resolveNote(note.inReplyTo, resolver).catch(e => {
// 4xxの場合はリプライしてないことにする
if (e.statusCode >= 400 && e.statusCode < 500) {
logger.warn(`Ignored inReplyTo ${note.inReplyTo} - ${e.statusCode} `);
return null;
const reply: Note | null = note.inReplyTo
? await resolveNote(note.inReplyTo, resolver).then(x => {
if (x == null) {
logger.warn(`Specified inReplyTo, but nout found`);
throw 'inReplyTo not found';
} else {
return x;
}
}).catch(e => {
logger.warn(`Error in inReplyTo ${note.inReplyTo} - ${e.statusCode || e}`);
throw e;
})