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

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 const reply: Note | null = note.inReplyTo
? await resolveNote(note.inReplyTo, resolver).catch(e => { ? await resolveNote(note.inReplyTo, resolver).then(x => {
// 4xxの場合はリプライしてないことにする if (x == null) {
if (e.statusCode >= 400 && e.statusCode < 500) { logger.warn(`Specified inReplyTo, but nout found`);
logger.warn(`Ignored inReplyTo ${note.inReplyTo} - ${e.statusCode} `); throw 'inReplyTo not found';
return null; } else {
return x;
} }
}).catch(e => {
logger.warn(`Error in inReplyTo ${note.inReplyTo} - ${e.statusCode || e}`); logger.warn(`Error in inReplyTo ${note.inReplyTo} - ${e.statusCode || e}`);
throw e; throw e;
}) })