fix: fix the example code of error handling (#47)
Co-authored-by: Tomsun28 <tomsun28@outlook.com>
This commit is contained in:
parent
d8e16ae166
commit
fec2f2bd7b
2 changed files with 4 additions and 4 deletions
|
|
@ -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}")
|
||||||
|
|
|
||||||
|
|
@ -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}")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue