add debug to error

This commit is contained in:
cutestnekoaqua 2023-02-13 16:53:56 +01:00
parent 113a1ebe59
commit a480e1be55
No known key found for this signature in database
GPG Key ID: 6BF0964A5069C1E0

View File

@ -299,9 +299,11 @@ export function apiAccountMastodon(router: Router): void {
const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const BASE_URL = `${ctx.protocol}://${ctx.hostname}`;
const accessTokens = ctx.headers.authorization; const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens); const client = getClient(BASE_URL, accessTokens);
let users;
try { try {
const idsRaw = (ctx.query as any)["id[]"]; const idsRaw = (ctx.query as any)["id[]"];
const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw; const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw;
users = ids;
relationshopModel.id = idsRaw || "1"; relationshopModel.id = idsRaw || "1";
if (!idsRaw) return [relationshopModel]; if (!idsRaw) return [relationshopModel];
const data = (await client.getRelationships(ids)) as any; const data = (await client.getRelationships(ids)) as any;
@ -310,7 +312,7 @@ export function apiAccountMastodon(router: Router): void {
console.error(e); console.error(e);
console.error(e.response.data); console.error(e.response.data);
ctx.status = 401; ctx.status = 401;
ctx.body = e.response.data; ctx.body = { ...e.response.data, ...{user: users} };
} }
}); });
router.get("/v1/bookmarks", async (ctx) => { router.get("/v1/bookmarks", async (ctx) => {