fix(route/twitter): throw exception on invalid user

This commit is contained in:
Tony 2026-06-04 05:25:46 +08:00
parent 5eb4e3701d
commit fbe1a46018
1 changed files with 7 additions and 0 deletions

View File

@ -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,