给定一个python脚本用于获取网页内容，要求脚本中以try-except结构编写代码，捕捉所有可能出现的异常，并将捕获的异常信息输出到控制台
user
```python
import requests

def fetch_web_content(url):
    try:
        response = requests.get(url)
        response.raise_for_status()  # Raise an HTTPError for bad responses (4xx or 5xx)
        content = response.text
        return content
    except requests.exceptions.RequestException as e:
        print(f"An error occurred: {e}")
        return None

url = "https://example.com"
content = fetch_web_content(url)
if content:
    print("Web content successfully fetched.")
```
assistant