fix: fix the example code of error handling (#47)

Co-authored-by: Tomsun28 <tomsun28@outlook.com>
This commit is contained in:
Yixuan Qiu 2025-11-18 18:50:21 +08:00 committed by GitHub
parent d8e16ae166
commit fec2f2bd7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -345,9 +345,9 @@ try:
) )
print(response.choices[0].message.content) print(response.choices[0].message.content)
except zai.APIStatusError as err: except zai.core.APIStatusError as err:
print(f"API Status Error: {err}") print(f"API Status Error: {err}")
except zai.APITimeoutError as err: except zai.core.APITimeoutError as err:
print(f"Request Timeout: {err}") print(f"Request Timeout: {err}")
except Exception as err: except Exception as err:
print(f"Unexpected Error: {err}") print(f"Unexpected Error: {err}")

View file

@ -351,9 +351,9 @@ try:
) )
print(response.choices[0].message.content) print(response.choices[0].message.content)
except zai.APIStatusError as err: except zai.core.APIStatusError as err:
print(f"API状态错误: {err}") print(f"API状态错误: {err}")
except zai.APITimeoutError as err: except zai.core.APITimeoutError as err:
print(f"请求超时: {err}") print(f"请求超时: {err}")
except Exception as err: except Exception as err:
print(f"其他错误: {err}") print(f"其他错误: {err}")