Refactor request (#7814)
* status code
* Test ap-request.ts
4397fc5e70/test/ap-request.ts
* tune
This commit is contained in:
parent
03b04acb16
commit
482081c41b
12 changed files with 268 additions and 174 deletions
|
|
@ -4,6 +4,7 @@ import { createNote, fetchNote } from '../../models/note';
|
|||
import { getApId, IObject, ICreate } from '../../type';
|
||||
import { getApLock } from '@/misc/app-lock';
|
||||
import { extractDbHost } from '@/misc/convert-host';
|
||||
import { StatusError } from '@/misc/fetch';
|
||||
|
||||
/**
|
||||
* 投稿作成アクティビティを捌きます
|
||||
|
|
@ -32,7 +33,7 @@ export default async function(resolver: Resolver, actor: IRemoteUser, note: IObj
|
|||
await createNote(note, resolver, silent);
|
||||
return 'ok';
|
||||
} catch (e) {
|
||||
if (e.statusCode >= 400 && e.statusCode < 500) {
|
||||
if (e instanceof StatusError && e.isClientError) {
|
||||
return `skip ${e.statusCode}`;
|
||||
} else {
|
||||
throw e;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue