From f7964da89946002e3b23daf492b9a024b828c06e Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 21 Dec 2018 00:09:02 +0900 Subject: [PATCH] Fix: ap/show does not return on error (#3704) --- src/server/api/endpoints/ap/show.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/server/api/endpoints/ap/show.ts b/src/server/api/endpoints/ap/show.ts index ed1a883f9..3b4021e0a 100644 --- a/src/server/api/endpoints/ap/show.ts +++ b/src/server/api/endpoints/ap/show.ts @@ -25,11 +25,10 @@ export const meta = { }, }; -export default define(meta, (ps) => new Promise(async (res, rej) => { - const object = await fetchAny(ps.uri); - if (object == null) return rej('object not found'); - - res(object); +export default define(meta, (ps) => new Promise((res, rej) => { + fetchAny(ps.uri) + .then(object => object != null ? res(object) : rej('object not found')) + .catch(e => rej(e)); })); /***