fix(route/twitter): throw exception on invalid user
This commit is contained in:
parent
5eb4e3701d
commit
fbe1a46018
|
|
@ -164,6 +164,13 @@ const getList = async (id: string, params?: Record<string, any>) =>
|
|||
|
||||
const getUser = async (id: string) => {
|
||||
const userData: any = await getUserData(id);
|
||||
|
||||
if (!userData.data.user) {
|
||||
throw new InvalidParameterError("This account doesn't exist");
|
||||
} else if (userData.data.user.result.__typename === 'UserUnavailable') {
|
||||
throw new InvalidParameterError(userData.data.user.result.message || 'User is unavailable');
|
||||
}
|
||||
|
||||
return {
|
||||
profile_image_url: userData.data?.user?.result?.avatar?.image_url,
|
||||
...userData.data?.user?.result?.core,
|
||||
|
|
|
|||
Loading…
Reference in New Issue