summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-09-26 00:57:54 +0200
committerMar0xy <marie@kaifa.ch>2023-09-26 00:57:54 +0200
commit3b2bf0dc358c4dc20737046918a06f9cfc570b5b (patch)
tree338ed4f000009e4321127d25ff3ff2e69c361035
parenttest: attempt catching error (diff)
downloadsharkey-3b2bf0dc358c4dc20737046918a06f9cfc570b5b.tar.gz
sharkey-3b2bf0dc358c4dc20737046918a06f9cfc570b5b.tar.bz2
sharkey-3b2bf0dc358c4dc20737046918a06f9cfc570b5b.zip
test: try using if statement
-rw-r--r--packages/megalodon/src/misskey.ts17
1 files changed, 10 insertions, 7 deletions
diff --git a/packages/megalodon/src/misskey.ts b/packages/megalodon/src/misskey.ts
index fe9f553ad4..294ad7b5ea 100644
--- a/packages/megalodon/src/misskey.ts
+++ b/packages/megalodon/src/misskey.ts
@@ -628,16 +628,19 @@ export default class Misskey implements MegalodonInterface {
}
}
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
+ if ((res.data as any)["error"]) {
+ return Object.assign(res, {
+ data: {
+ accounts: [],
+ statuses: [],
+ hashtags: [],
+ }
+ })
+ }
return Object.assign(res, {
data: res.data.map(u => MisskeyAPI.Converter.userDetail(u, this.baseUrl))
})
- }).catch(() => ({
- data: {
- accounts: [],
- statuses: [],
- hashtags: [],
- }
- }))
+ })
}
// ======================================