Error handling for get_user

This commit is contained in:
Sarina
2024-07-23 18:23:47 +03:30
parent b028d3fbc9
commit fe47551904

View File

@ -139,7 +139,12 @@ hysteria2_get_user_handler() {
echo -e "${red}Error:${NC} Username can only contain lowercase letters and numbers."
fi
done
python3 $CLI_PATH get-user --username "$username"
# Run the command and suppress error output
if ! python3 "$CLI_PATH" get-user --username "$username" > /dev/null 2>&1; then
echo -e "${red}Error:${NC} User '$username' not found."
return 1
fi
}
hysteria2_list_users_handler() {